finally block
The block of a try statement that runs on every way out: normal end, caught or uncaught exception, or return.
It runs after a return value has been computed and before the method returns; only System.exit or the JVM stopping skips it.
Examples
try { ... return "ok"; } finally { IO.println("done"); }printsdonebefore the method returns.
See also