try catch finally 执行顺序问题
生活随笔
收集整理的這篇文章主要介紹了
try catch finally 执行顺序问题
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
public static void main(String[] args) {System.out.println(abc());}public static Integer abc(){System.out.println("開始");try{System.out.println("報錯前");int i = 1/0;System.out.println("報錯了");return 1;}finally{try {Thread.sleep(5000);} catch (InterruptedException e) {// TODO Auto-generated catch blocke.printStackTrace();}System.out.println("小樣");}}
輸出順序: 開始
報錯前
小樣
exception / by zero
總結(jié)
以上是生活随笔為你收集整理的try catch finally 执行顺序问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FreeMaker导出word
- 下一篇: GET和POST两种基本请求方法的区别(