Java error handling
by, 01-08-2012 at 11:56 AM (1448 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.
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.