Compiling Code with assert Statements Because previous versions of Java did not have an assert statement, you must inform the compiler that your code is to be compiled as Java 1.4 by including the following compile option in your javac command line: -source 1.4 For instance:javac -source 1.4 AssertionDemo.javaRunning Programs with assert Statements You must explicitly turn assertions on in your code by using the -ea (-enableassertions) flag with your java command. For instance: java -ea AssertionDemo
Because previous versions of Java did not have an assert statement, you must inform the compiler that your code is to be compiled as Java 1.4 by including the following compile option in your javac command line: -source 1.4
For instance:javac -source 1.4 AssertionDemo.javaRunning Programs with assert Statements
You must explicitly turn assertions on in your code by using the -ea (-enableassertions) flag with your java command. For instance: java -ea AssertionDemo