public class Test {
public static void main(String [] args) {
Boolean b = true;
int i = 10;
String str = "Hello World";
assert (b == true) : "true";
assert (i != 10) : "false";
System.out.println(str);
}
}
Hey, guys! Try to run in this way: 1) open terminal create Test.java file with the code in the question; 2) compile with command `javac Test.java`; 3) run command `java Test` - it will work; 4) run command `java -ea Test` it will fail with next error: Exception in thread "main" java.lang.AssertionError: false at Test.main(Test.java:7)
2017 Oct 27, 3:25:50 PM
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать