Because finally
block will be executed every time whether you enter in try
or in catch
, I think that's why its called finally :)
FROM JAVA DOCS
The finally block always executes when the try block exits. This
ensures that the finally block is executed even if an unexpected
exception occurs.
Note: It won't be executed only when
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.