Exceptions:The finally Block
Example to show Finally exception in java
The Finally block in java is used along with the try-catch statements.This block executed even after the unexpected exception occured.The Run time always execute the expression in finally block irrespective of the try block. The main usage of finally block is to do clean up job. Keeping cleanup code in a finally block is always a good practice, even when no exceptions are occured. The runtime system always executes the code within the finally block regardless of what happens in the try block. So it is the ideal place to keep cleanup code.