Exception hierarchy

All exception classes in Kotlin and Java are inherited from the Throwable class. The Throwable class has two direct inheritors—Exception and Error. The Exception class, in turn, has inheritors for more specific cases, such as the IOException and RuntimeException classes:

  • IOException is a general class of exceptional events related to input/output operations
  • RuntimeException is the superclass for exceptions such as NullPointerException, which can be thrown during Java Virtual Machine operation invoking

Subclasses of the Error class are used to indicate abnormal conditions that may occur in the application. The widely occurring inheritor of Error is the OutOfMemoryError class. Instances of this class can be thrown when the Java Virtual Machine cannot allocate memory for a new object.

The following diagram shows class hierarchy:

To overview all direct inheritors of the Exception class, you can go to the source code of this class and open Navigate | Type Hierarchy:

You will then see a window that shows all of the direct subclasses of the Exception class:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.245.167