The Throwable Class

Java has a class called Throwable, from which two major classes, Error and Exception, inherit. Figure 10.1 shows the class hierarchy.

Figure 10.1. Class hierarchy for Error and Exception.

A Java developer normally doesn't do anything with Throwable, so I'll not consider this class. You have to have a class that is a subclass of Throwable, however, to throw an error or exception. All Throwable objects contain information on the execution stack for the executing Thread at the time the error or exception object was created. You also won't write any code to deal with Error or any subclasses of it. An Error stems from events like ...

Get PURE Java™ 2 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.