Assertion Command-Line Switches : assert « Statements « SCJP






Command-Line Example                           What It Means

java -ea java -enableassertions                Enable assertions.

java -da java -disableassertions               Disable assertions (the default behavior of Java 6).

java -ea:com.foo.Bar                           Enable assertions in class com.foo.Bar.

java -ea:com.foo...                            Enable assertions in package com.foo and any of its subpackages.

java -ea -dsa                                  Enable assertions in general, but disable assertions in system classes.

java -ea -da:com.foo...                        Enable assertions in general, but disable assertions in package com.foo and any of its subpackages.








5.13.assert
5.13.1.Assertions give you a way to test your assumptions during development and debugging.
5.13.2.The new assert keyword has the following syntax
5.13.3.Assertion Command-Line Switches
5.13.4.Do Use Assertions to Validate Arguments to a Private Method
5.13.5.Use Assertions to Check for unreachable code