finally会被执行到
1.catch中 throw
try{ int i = 1/0; }catch (Exception e) { throw e; }finally { System.out.println("finally"); }
2.catch中return
try{ int i = 1/0; }catch (Exception e) { return; }finally { System.out.println("finally"); }
finally不会被执行到
1.catch中退出程序
try{ int i = 1/0; }catch (Exception e) { System.exit(1); }finally { System.out.println("finally"); }