Sun’s SCJP 1.4 Assertion feature

The SCJP 1.4 exam covers the topics on (1) Assertions, (2) Collections, (3) Wrapper Classes and (4) Equals and Hash Code.   An assertion is a new topic or area of study that is new from the SCJP version 1.4.  The assertion is a facility that provides a mechanism for adding optional sanity checks to code. These are control mechanism used during the development and testing phases and is turned off when the software is deployed.

The assertion in java programming language enables a programmer to test assumptions of the program. It contains a  boolean expression believed to be true as assertion is executed. If not true, an error in the system will be thrown. As the boolean expression is verified to be true, the assertion confirms the program’s behavior increasing the program to be free of errors.

Assertion writing is one of the fastest and effective ways in detecting and correcting bugs.  It also serves to document the inner workings of the program and enhancing its maintainability. An assertion is to prove correctness in terms of the system’s compliance to specification.  It complements reliability attribute, robustness that relates to the ability of the system to handle abnormal conditions. An assertion adds to the ability to provide optional pre- and post-condition validation as a method for improved testing. Assertions can be disabled during run time and be enabled, as errors are check as to error conditions.   The SCJP 1.3 assertion is one of Sun’s Certified new release and is considered as a facility for exception handling.

Recommended For You

Leave a Reply