有一個 try/catch 代碼塊,finally代碼塊總會被執行麼?

一、finally 將會被調用。
只有如下狀況 finally 不會被調用:spa

  • 當你使用 System.exit() 後線程

  • 其餘線程干擾瞭如今運行的線程(經過 interrupt 方法)code

  • JVM 崩潰( crash )了orm

相關文章
相關標籤/搜索