public class MyClass {
public static int test() {
try {
System.out.println("return 1");
return 1;
} catch(Exception e) {
System.out.println("return 2");
return 2;
} finally {
System.out.println("Finally will execute even after a return");
}
}
public static void main(String args[]) {
System.out.println(test());
}
}
/*
run:
return 1
Finally will execute even after a return
1
*/