11.3. Run-Time Handling of an Exception
When an exception is thrown (§14.18), control is transferred from the code that caused the exception to the nearest dynamically enclosing catch
clause, if any, of a try
statement (§14.20) that can handle the exception.
A statement or expression is dynamically enclosed by a catch
clause if it appears within the try
block of the try
statement of which the catch
clause is a part, or if the caller of the statement or expression is dynamically enclosed by the catch
clause.
The caller of a statement or expression depends on where it occurs:
• If within a method, then the caller is the method invocation expression (§15.12) that was executed to cause the method to be invoked.
• If within a constructor or an instance ...
Get The Java® Language Specification, Java SE 7 Edition, Fourth 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.