I just learned the lesson of Java Exception Handling
. And I learned Java finally
block is always executed whether exception is handled or not.
finally block
Is there any case when finally will not be executed?
finally block
will not be executed if program exits; either by calling System.exit()
or by causing a fatal error that causes the process to abort.
More information - https://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html
The finally block is always called, except maybe if you do a System.exit().