Core Java

We know that, In java, Exception can be either checked or unchecked and same has been shown in the below exception hierarchy

Parent class of all exceptions in java is “Throwable” class.

Any instance of Throwable class can be caught using catch block except Error.

We can’t handle errors in Java through program.

exception_Hierarchy

Exception hierarchy mainly consists of Exception and Error

Where Error is something which we can’t handle programmatically but we can handle exceptions through program.

Any subclass of Exception can be handled programmatically in Java.

Throwable represent the super class of all exceptions and also Runtime Errors in Java.

Exception and its sub-classes represent unusual conditions in a program which is expected to occur but can recover from.

It has all the behaviours of checked exception.

Example : FileNotFoundException,SQLException

RuntimeException is a subclass of Exception

RuntimeException and its sub-classes represent unusual conditions in a program which is generally not expected to occur but can recover from.

It has all the behaviours of unchecked exception.

Example : NullPointerException,ArithmeticException

Error sub-classes represent “serious” errors that a program can’t catch and recover from.

Example : expected class file being missing, or an OutOfMemoryError.

Exception class acts as checked exception and its subclass RuntimeException class acts as Unchecked exception.

Remember :
Checked exceptions are forced by compiler to handle whereas unchecked exceptions are not forced to handle but Its good to handle.
Share this article on

Comment (9)

    1. Karibasappa G C (KB)
      Karibasappa G C (KB)

      First thing, static variables will never be a part of method, it will be a part of class always.

      So only we cant declare any static variables inside a method but we can access them inside a method.

      All static variables will be stored in separate segment inside Heap area only.

      1. The blog is very helpful. Thanks a lot for sharing! Also the “Inheritance in interface” page is not opening. Can you please fix that?

Leave a Comment

  • You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" extra="">

    • Please answer this simple challenge to post your valuable comment *