Java Finally block – Exception handling
Syntax of Finally block:
Example of Finally Block:
When you run this program, it will output:
Parent Exception
finally block is already executed
Execution done
When an exception occur but not handled by the catch block Example:
When you run this program, it will output:
finally block is always executed
Exception in thread “main” java.lang.ArithmeticException: / by zero
Visited 1 times, 1 visit(s) today