| |
Using Assertions in Java Technology |
 | | Assertions, however, should be used to check for cases that should never happen, check assumptions about data structures (such as ensuring that an array is of the correct length), or enforcing constraints on arguments of private methods. |
 | | This is because, by default, assertions are disabled at runtime. |
 | | The new assertion facility in J2SE 1.4 (and later versions) provides a unified support for assertions in Java technology as well as a convenient way for developers both to turn assertions on and off as needed and to abort Java programs while printing a message that states where in the program the error was detected. |
| java.sun.com /developer/technicalArticles/JavaLP/assertions (2553 words) |