`
85977328
  • 浏览: 1871068 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

finally不执行的陷阱

 
阅读更多
写了个DEMO,说明下finally在System.exit(-1);的后面,是不被执行的。
/**
 * @author piaohailin
 * @date 2014-5-16
 */
public class FinalTest {

    public static void main(String[] args) {
        try {
            System.exit(-1);
        } catch (Exception e) {

        } finally {
            System.out.println("finally");
        }
    }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics