1
JavaAdvanced#exceptions
try runs first; if an exception occurs, the matching catch runs. finally always executes afterward regardless of whether an exception was thrown or caught, typically used for cleanup, unless the JVM exits via System.exit().
try { throw new RuntimeException("x"); }
catch (RuntimeException e) { System.out.println("caught"); }
finally { System.out.println("cleanup"); }
// prints: caught, cleanup