View RSS Feed

Java Exception

Java error handling

Rate this Entry
by , 01-08-2012 at 12:56 PM (1633 Views)
When a hard failure or link failure occurs in virtual machine, JVM throws an Error. These Errors are not caught by the typical java programs.

When a problem occurs in the code, an Exception is thrown and is caught by the program explicitly. Base class of all Exception classes is Exception class. All other are derived classes. Below image shows a complete hierarchy of the exceptions in java.

Name:  62.JPG
Views: 1216
Size:  16.3 KB

Throwable and subclasses

A RuntimeException occurs within JVM like NullPointerException. Catching these exceptions in the code increases performance issues but makes the code more reliable. All the exceptions should catch in the above hierarchy. Also you can customize these exceptions and can write your own custom exceptions.

Submit "Java error handling" to Facebook Submit "Java error handling" to Digg Submit "Java error handling" to Submit "Java error handling" to StumbleUpon Submit "Java error handling" to Google