Nikhil Nikhil - 1 year ago 99
Java Question

Try-catch-finally in java

In Java, will the finally block not get executed if we insert a return statement inside
the try block of a try-catch-finally ?

Answer Source

The only time a finally block will not be executed is when you call exit() before finally is reached. The exit() call will shutdown the JVM, so no subsequent line of code will be run.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download