Checked Vs Unchecked Exceptions

Posted: May 8, 2012 in Java

Checked Vs Unchecked Exceptions:

Checked Exception:

The Exceptions that are checked by the compiler for smooth execution of the program at run time are called Checked Exceptions.

Example:

Exception

IOException

FileNotFoundException

ParseException

ClassNotFoundException

CloneNotSupportedException

InstantiationException

InterruptedException

NoSuchMethodException

NoSuchFieldException

EOFException

Unchecked Exception:

The Exceptions which are unable to checked by the compiler are called unchecked Exceptions

RuntimeExceptions & its child class, Error and its child classes are Unchecked exceptions.

All the remaining are considered as Checked Exception.

Example:

Arithmetic Exception

ArrayIndexOutOfBoundsException

ClassCastException

IllegalArgumentException

IllegalStateException

NullPointerException

NumberFormatException

AssertionError

ExceptionInInitializerError

StackOverflowError

NoClassDefFoundError

Partially Checked Vs Fully Checked Exceptions:

Fully Checked Exceptions:

A checked exception is said to be fully checked exception if and only if all its child classes are also checked exceptions.

Example: IOException , Interrupted Exception

Partially Checked Exceptions:

All the remaining checked exceptions are considered as partially checked exception

Example: Exception , Throwable

All Exceptions Diagram:

All Errors Diagram:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s