Enabling Assertions
Java will only execute assertions if you enable them with the -ea option:
> java -ea ClassToRun
Unlike other programming languages, it is not possible in Java to tell the compiler to exclude assertions from the binary. javac will always compile them into the classes.
The Java runtime can also be configured to execute assertions only for specific packages or classes. See the Java launcher documentation for more details.

