Yes,
finally
will be called.
The only times
finally
won't be called are:- If you invoke
System.exit()
; - If the JVM crashes first;
- If there is an infinite loop (or some other non-interruptable, non-terminating statement) in the
try
block; - If the OS forcibly terminates the JVM process.
- If the host system dies; e.g. power failure, hardware error, etc.
No comments:
Post a Comment