The Java programming language uses exceptions to handle errors and other exceptional events. This lesson describes when and how to use exceptions.
An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.
This section covers how to catch and handle exceptions. The discussion includes the
catch , and
finally blocks, as well as chained exceptions and logging.
This section covers the
throw statement and the
Throwable class and its subclasses.
This section describes the
try -with-resources statement, which is a
try statement that declares one or more resources. A resource is as an object that must be closed after the program is finished with it. The
try -with-resources statement ensures that each resource is closed at the end of the statement.
This section explains the correct and incorrect use of the unchecked exceptions indicated by subclasses of
The use of exceptions to manage errors has some advantages over traditional error-management techniques. You'll learn more in this section.