Warrior Warrior - 1 month ago 18
Java Question

Does a finally block always run?

Is there any condition where finally might not run in java? Thanks.

Answer

from the Sun Tutorials

Note: If the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues.

I don't know of any other ways the finally block wouldn't execute...