---
title: "Exception class hierarchy from Throwable"
subject: "Object Oriented Analysis and Design"
chapter: 4
key: "semester_6/object_oriented_analysis_and_design:exception-class-hierarchy-throwable"
source: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/exception-class-hierarchy-throwable
site: BCT Engineering
---

# Exception class hierarchy from Throwable

Object Oriented Analysis and Design · Chapter 4: Implementation

- Asked in: 2072 Asoj, 5 marks
- Video: [L45: Exception Hierarchy in Java | Throwable, Exception, Error | Java Programming Lectures in Hindi](https://www.youtube.com/watch?v=S5K1T4GqdJE) — Easy Engineering Classes
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/exception-class-hierarchy-throwable
- Whole chapter: https://www.bctengineer.com/md/semester_6/object_oriented_analysis_and_design/chapter-4

## Question

Draw an exception class hierarchy to present the errors and exceptions derived from the Throwable class.

## Short answer

Throwable is the root; its subclasses are Error (unchecked, e.g., OutOfMemoryError, StackOverflowError) and Exception (checked). Exception includes IOException, SQLException, and RuntimeException (unchecked) with subclasses like NullPointerException, ArithmeticException, IndexOutOfBoundsException, etc. Catch blocks should order most specific first.

## Answer

In Java, `Throwable` is the root class of everything that can be thrown. It has two direct subclasses: `Error` and `Exception`.

```text
Throwable
 |
 +-- Error                      (unchecked)
 |    +-- VirtualMachineError
 |    |     +-- OutOfMemoryError
 |    |     +-- StackOverflowError
 |    +-- AssertionError
 |    +-- LinkageError
 |
 +-- Exception                  (checked)
      +-- IOException
      |     +-- FileNotFoundException
      |     +-- EOFException
      +-- SQLException
      +-- ReflectiveOperationException
      |     +-- ClassNotFoundException
      +-- InterruptedException
      +-- RuntimeException      (unchecked)
            +-- ArithmeticException
            +-- NullPointerException
            +-- ClassCastException
            +-- IndexOutOfBoundsException
            |     +-- ArrayIndexOutOfBoundsException
            +-- IllegalArgumentException
                  +-- NumberFormatException
```

Other subclasses of `Exception` include `CloneNotSupportedException` and `TimeoutException`.

#### Explanation
- **Throwable:** provides `getMessage()` and `printStackTrace()`; only its objects can be thrown or caught.
- **Error:** serious problems in the JVM or system that an application should not try to handle (`OutOfMemoryError`, `StackOverflowError`). **Unchecked**.
- **Exception:** conditions that a program can reasonably catch.
  - **Checked exceptions** (`IOException`, `SQLException`, `ClassNotFoundException`): the compiler requires `try/catch` or a `throws` clause.
  - **Unchecked (runtime) exceptions** (`RuntimeException` and its subclasses: `ArithmeticException`, `NullPointerException`, `ArrayIndexOutOfBoundsException`): caused by programming errors; handling them is optional.

Order of `catch` blocks: the specific subclass comes first, then its superclass.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What are the two direct subclasses of Throwable?
   A. Exception and RuntimeException
   B. Error and Exception
   C. IOException and Error
   D. Checked and Unchecked
   Answer: B. Throwable is the root with two direct subclasses, Error and Exception. (Key point: Throwable subclasses)

2. How should an application treat an Error such as OutOfMemoryError?
   A. Catch and fix it as a normal case
   B. It is a serious JVM/system problem that an application should not try to handle
   C. It is a checked exception
   D. It is a subclass of RuntimeException
   Answer: B. Errors are serious, unchecked problems in the JVM or system and are not normally handled. (Key point: Errors)

3. Which is a checked exception, requiring try/catch or throws?
   A. NullPointerException
   B. ArithmeticException
   C. IOException
   D. StackOverflowError
   Answer: C. IOException (like SQLException) is checked; the compiler requires handling or declaring it. (Key point: Checked exceptions)

4. In what order should catch blocks be written?
   A. Superclass first, then subclass
   B. Specific subclass first, then its superclass
   C. Any order
   D. Only one catch block is allowed
   Answer: B. A superclass catch placed first would hide the subclass catch, so specific ones come first. (Key point: Catch ordering)

## Related in other subjects

- [Access overridden members from derived class](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aaccess-overridden-members) — Object Oriented Programming, chapter 6, asked 2×
- [Stream class hierarchy](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Astream-class-hierarchy) — Object Oriented Programming, chapter 8, asked 4×
- [Date of birth validation with exceptions](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Adob-exception-program) — Object Oriented Programming, chapter 10
- [Manager derived from person and employee](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Amanager-person-employee) — Object Oriented Programming, chapter 6
