Is it possible to have finally block without catch block?

Is it possible to have finally block without catch block?

The finally should have atleast a try block, catch is optional. The point of finally blocks is to make sure that the piece of code must be executed whether an exception is thrown or not.

A finally clause ensures that the finally block is executed after the try block and any catch block that might be executed, no matter how control leaves the try block or catch block.

Hence a finally should always be preceded by a try block.


Read More →