Reputation: 37034
I faced with assertion in java
public static void main(String[] args) {
assert true;
assert false;
}
I don't understand why I don;t see assertion error at this case?
What do this code snippet do?
Upvotes: 0
Views: 93
Reputation: 272257
Assertions need to be enabled when you launch the JVM e.g.
$ java -ea ...
By default, assertions are disabled at runtime. Two command-line switches allow you to selectively enable or disable assertions.
To enable assertions at various granularities, use the -enableassertions, or -ea, switch
Note that you can enable/disable per class/package if you require.
As to how you perform this with IDEA, you need to modify the VM options for your particular run/debug configuration.
Upvotes: 5