Using Assertions in Java Technology

By Angsuman Chakraborty, Gaea News Network
Monday, July 18, 2005

You can use assertions to detect errors that may otherwise go unnoticed. Assertions contain Boolean expressions that define the correct state of your program at specific points in the program source code. The designers of the Java platform, however, didn’t include support for assertions. Perhaps they viewed exceptions as a superior feature, allowing you to use try/catch/finally to throw an exception instead of aborting the program as in assertions. But the Java 2 Platform, Standard Edition (J2SE) release 1.4, has introduced a built-in assertion facility. This article does the following:

* Presents an overview of design by contract
* Presents an overview of assertions
* Shows how to roll your own assertion capabilities
* Describes the new assertion facility
* Shows how to use the new assertion facility
* Offers guidelines for using assertions
* Presents examples of how to use assertions

Read the article here; highly recommended.

Filed under: Java Software
YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :