System.exit(0)会跳过finally块的执行


public class test {
    public static void main(String[] args) {
        try {
            System.exit(0);
            System.out.println("hello");
        } finally {
            System.out.println("In the finally block");
        }
    }
}

System.exit(0)会跳过finally块的执行,什么都不输出。

 
posted @ 2017-10-17 18:15  麻雀虽小五脏俱全  阅读(1186)  评论(0编辑  收藏  举报