java中异常注意的细节1
生活随笔
收集整理的這篇文章主要介紹了
java中异常注意的细节1
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/* public class Test{public static void main(String[] args){int i=0;try{func();//區別就是該函數拋出的異常被封裝了,外界不知道到底會不會發生該異常System.out.println("i = " + i++);//所以這句話是有機會執行的}catch(Exception e){System.out.println("i = " + i++);}}static void func() throws Exception{throw new Exception();}
}*/
public class Test{public static void main(String[] args){int i=0;try{ throw new Exception();System.out.println("i = " + i++);//完全的廢話,肯定不會被執行到}catch(Exception e){System.out.println("i = " + i++);}System.out.println("i = " + i++);}
}
轉載于:https://www.cnblogs.com/hujunzheng/p/3872643.html
總結
以上是生活随笔為你收集整理的java中异常注意的细节1的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 盈趣科技是做什么的 各方面了解一下
- 下一篇: lintcode Permutation