|
|
|
|
|
by Joker_vD
214 days ago
|
|
No, it's not executed before the return, it's executed in the middle of it, so to speak: class Main {
static int f() { System.out.println("f()"); return 1; }
static int g() { System.out.println("g()"); return 2; }
static int h() {
try {
return f();
} finally {
return g();
}
}
public static void main(String[] args) {
System.out.println(h());
}
}
will print f()
g()
2
If "finally" block was executed before the "return" in the "try", the call to f() would not have been made. |
|