Question: error handling mechanism
The exception handling mechanisms in Java provide a clean way to check for errors without cluttering code. Exceptions also provide a means to signal errors directly rather than use flags or side effects such as fields that must be checked. Exceptions make the error conditions that a method can signal an explicit part of the methods contract. The list of exceptions can be seen by the programmer, checked by the compiler and preserved by extended classes that override the method.
Traditional error handling methods include Boolean functions (which return TRUE/FALSE), integer functions (returns â??1 on error) and other return arguments and special values. Some of the drawbacks associated with these methods are that the programmer must remember to check for the return codes, it can lead to diminished readability of the source code, and one cannot rely on the functions being consistent.
For more detailed study go to the link-