Information Technology Reference
In-Depth Information
Finding a Handler for an Exception
When a program raises an exception, the system checks to see whether the program has pro-
vided an exception handler for it. The flow of control is illustrated in Figure 11-6.
If the exception occurred inside a
try
block, the system will check to see whether any of
the
catch
clauses can handle the exception.
If an appropriate
catch
clause is found
-The
catch
clause is executed.
-
If there is a
finally
block, it is executed.
Execution continues after the end of the
try
statement (i.e., after the
finally
block,
or after the last
catch
clause if there is no
finally
block).
-
Figure 11-6.
Exception with handler in current try statement