 |
Assertions allow a programmer to test their assumptions about a program's behaviour. For example, ensure that the result of some calculation is always greater than zero. Before J2SE 1.4, a programmer had to write their own assertion mechanism such as coding a utility class method. J2SE 1.4 added the assert keyword. Read Programming With Assertions for an introduction to using assert. If you already use or plan to use assertions, you may also want to read about the Assertions Are Free Misconception.
The assertions facility was introduced to Java via JSR-41 A Simple Assertion Facility.
Articles
Discussion about Assertions
|