Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java assert

    public static void main(String[] args) {
        int a = 6;
        assert a != 6 : "a != 6";
    }
//Exception in thread "main" java.lang.AssertionError: a != 6

Foo result = null;
assert result != null;

final int result = a + b;
assert (result - a == b) : "Sum of " + a + " + " + b + " returned wrong sum " + result;
Comment

Java assert keyword

assert condition;
Comment

PREVIOUS NEXT
Code Example
Java :: get field name java 
Java :: Java if...else Statement 
Java :: random number 
Java :: Java empty() Method 
Java :: java.lang.classcastexception: java.lang.string cannot be cast to java.util.arraylist 
Java :: run java file 
Java :: what is abstraction in java 
Java :: convert string to int in java 
Java :: call by value and call by reference in java 
Java :: java multi thread 
Java :: java change hashmap value 
Java :: change color in recyclerview 
Java :: string into ascii in java 
Java :: java creating an object 
Java :: The Longest Substring 
Java :: set up a tree in java 
Java :: iterate through arraylist java 
Java :: swagger ui java 
Java :: android hide and show bottom navigation 
Java :: android activity transition 
Java :: Java forEach() Method 
Java :: how to encrypt password in properties file in spring boot 
Java :: fabricmc concat text 
Java :: How to send saved CSV file via email 
Java :: intellij java fx new window 
Java :: get method jdbc 
Java :: set the content of a Jlist from an other Jlist (Swing) 
Java :: zoomin pdf in android studio 
Java :: thread dump 
Java :: what is difference between constant and final in java 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =