Abnormal try-catch-finally topic

1 try {
2     int a = 1/0;
3     return 1;
4 }catch (Exception e) {
5     return 2;
6 } finally {
7     return 3;
8 }

The second line encountered mathException exception, so the third line is not performing to jump to catch, if there is a return catch statement or make abnormal termination of the function, then if this time there is finally, finally it will go to perform in the statement, then perform catch in return.
But this time finally is a return statement, the function at this time is over.
Output 3

Guess you like

Origin www.cnblogs.com/xukangjia/p/11323865.html