I need to print the statement in the assertion to the console when condition is true in eclipse. How?
public static void main(String[] args) {
try {
assert(args[0].equals("x")): "kate";
} catch(Error e) {
System.out.print("ae ");
} finally {
try {
assert(args[0].equals("y")): "jane";
} catch(Exception e2) {
System.out.print("ae2 ");
}
}
}
You need to:

Now, when you have something like:
assert(1==2) : "Error!!!";
You'll see in the console:
Exception in thread "main" java.lang.AssertionError: Error!!!
at .....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With