码迷,mamicode.com
首页 > 其他好文 > 详细

finally是否始终执行

时间:2017-04-22 00:59:02      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:called   ora   change   continue   str   new   style   always   htm   

The only times finally won‘t be called are:

  1. If you call System.exit()
  2. If the JVM crashes first
  3. If there is an infinite loop in the try block
  4. If the power turns off

以上来自:Does finally always execute in Java?

 

另见Sun Tutorials中的note:



Note: If the JVM exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues.

 

finally是否始终执行

标签:called   ora   change   continue   str   new   style   always   htm   

原文地址:http://www.cnblogs.com/drizzlewithwind/p/6746639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!