It's all about Java: all
Showing posts with label all. Show all posts
Showing posts with label all. Show all posts

Monday, 11 January 2021

Java API support for Exception Handling

First of all, please read below blog post to understand basics of Exception Handling in java.

Exception handling and java keywords


To continue from there, Basically Java default API has hierarchy of  java classes to support different uses cases of exceptions. 

The parent class of all Exceptions and Errors is Throwable. Please check below pictorial representation of  API Hierarchy 

Exception:

The class Exception and any subclasses that are also not subclasses of RuntimeException are checked exceptions.

And all subclasses of RuntimeException and RuntimeException class itself are Unchecked exception. Rest all are Checked exceptions

Examples of Unchecked Exceptions: 

         ArrayIndexOutOfBoundException

         NullPointerException

Error:

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.

Examples: The ThreadDeath error


Popular posts

Atomicity with Java Programming Language

 Atomicity with Java What is Atomicity Atomicity, in computer science, is considered to be a property [ALL-OR-NOTHING], that the state of a ...