No, it will not be when the try-catch does not complete normally, then finally the block will not be executed.
Here is JLS or it points out:
If execution of the try block completes normally, then the finally block is executed
for catch block
If the catch block completes normally, then the finally block is executed.
Since you call System.exit , which terminates the program in a try block , then try-catch is not executed normally, so the finally block will not be executed.
For the return statement try-catch completes normally because you are not blocking the try block (for example, an infinite loop, a sleeping thread, terminating the program, etc.), so the finally block is executed after you return from the method.
source share