首页 > 其他 > 详细

finally是否始终执行

时间:2017-04-22 01:00:21      阅读:273      评论:0      收藏:0      [点我收藏+]

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是否始终执行

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!