Java tutorial
public class Main { // Through an exception out of the method. static void methodC() { try { System.out.println("inside methodC"); throw new RuntimeException("demo"); } finally { System.out.println("methodC finally"); } } // Return from within a try block. static void methodB() { try { System.out.println("inside methodB"); return; } finally { System.out.println("methodB finally"); } } // Execute a try block normally. static void methodA() { try { System.out.println("inside methodA"); } finally { System.out.println("methodA finally"); } } public static void main(String args[]) { try { methodC(); } catch (Exception e) { System.out.println("Exception caught"); } methodB(); methodA(); } }