-ea to enable assertions

With this option, assertions can be enabled (by default, they are turned off).

In a language that supports assertions, the programmer can add runtime conditional checks. In Java, this is done by adding an assert statement, followed by a condition. When assertions are disabled, these statements are ignored completely, but when enabled, the JVM throws an error if the condition turns out to be false. This can be used to check whether the program works as expected. An example of an assert statement in Java:

    int i = 25;    assert i < 24;

When assertions are enabled with the -ea option, the preceding code will result in a java.lang.Error instance thrown by the JVM once the assert statement runs. When not explicitly specified ...

Get Introduction to JVM Languages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.