Which is the Base Class of all Exceptions in Java?

Throwable is the base class of all exception and error classes in Java. Now let's understand how Exception and Error classes fit into Java class hierarchy.

There are two things in Java - exceptions and errors. An exception is an unwanted or unexpected event, which occurs during the execution of a program i.e at run time, that disrupts the normal flow of the program’s instructions.

Exception indicates conditions that a reasonable application might try to catch. Unlike exception, an Error indicates serious problem that a reasonable application should not try to catch.

All exception and error types are sub classes of class Throwable, which is base class in the hierarchy.

One branch is headed by Exception. This class is used for exceptional conditions that user programs should catch. NullPointerException is an example of such an exception.

Another branch belongs to Error that is used by the Java run-time system (JVM) to indicate errors having to do with the run-time environment itself (JRE). StackOverflowError is an example of such an error.

Following image shows the hierarchical relationship between Exception, Error and Throwable class.

base class of all exceptions in java

So, now you got the base class of exception in Java?. Please do write us if you have any suggestion/comment or come across any error on this page. Thank you for reading!



Share this page on WhatsApp

Get Free Tutorials by Email

About the Author

is the founder and main contributor for cs-fundamentals.com. He is a software professional (post graduated from BITS-Pilani) and loves writing technical articles on programming and data structures.