7.2. Categories of exceptions

[8.1] Differentiate among checked exceptions, unchecked exceptions, and Errors

The Java compiler and its runtime treat the exception categories in a different manner. This implies that separate rules exist to define methods that throw exceptions and code that handles them.

In this section, you’ll learn about the categories of exceptions in Java: checked exceptions, runtime exceptions, and errors.

7.2.1. Identifying exception categories

As depicted in figure 7.8, exceptions can be divided into three main categories:

  • Checked exceptions
  • Runtime exceptions
  • Errors
Figure 7.8. Categories of exceptions: checked exceptions, runtime exceptions, and errors
Note

Runtime exceptions and errors ...

Get OCA Java SE 8 Programmer I Certification Guide 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.