11.5 Java Exception Hierarchy
All Java exception classes inherit directly or indirectly from class Exception
, forming an inheritance hierarchy. You can extend this hierarchy with your own exception classes.
Figure 11.4 shows a small portion of the inheritance hierarchy for class Throwable
(a subclass of Object
), which is the superclass of class Exception
. Only Throwable
objects can be used with the exception-handling mechanism. Class Throwable
has two direct subclasses: Exception
and Error
. Class Exception
and its subclasses—for example, RuntimeException
(package java.lang
) and IOException
(package java.io
)—represent exceptional situations that can occur in a Java program and that can be caught by the application. Class Error
and its subclasses ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.