I run this code :
public static void main(String[] args) {
System.out.println(catcher());
}
private static int catcher() {
try {
System.out.println("TRY");
thrower();
return 1;
} catch (Exception e) {
System.out.println("CATCH");
return 2;
} finally {
System.out.println("FINALLY");
return 3;
}
}
private static void thrower() {
throw new RuntimeException();
}
and I expect to see this at output:
TRY
CATCH
FINALLY
2
but surprisingly the output is:
TRY
CATCH
FINALLY
3
I'm confused. where goes return 2
statement? Is return at finally
a bad-practice?