February 2014
Beginner
1248 pages
62h 25m
English
The finally block will execute whether or not an exception is thrown in the corresponding try block. The finally block also will execute if a try block exits by using a return, break or continue statement or simply by reaching its closing right brace. The one case in which the finally block will not execute is if the application exits early from a try block by calling method System.exit. This method, which we demonstrate in Chapter 15, immediately terminates an application.
If an exception that occurs in a try block cannot be caught by one of that try block’s catch handlers, the program skips the rest of the try block and control proceeds to the finally block. Then the program passes the exception to the next ...
Read now
Unlock full access