ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 以下两种情况不会运行 #### 中止jvm ``` public class FinallTest { public static void main(String[] args) { try { System.out.println("one"); System.exit(0); } catch (Exception e) { System.out.println("second"); System.exit(0); } finally { System.out.println("third"); } } } ``` #### 守护线程中的finally ``` public class FinallTest { public static void main(String[] args) { Thread thread = new Thread(new DeamanRunner()); thread.setDaemon(true); thread.start(); } static class DeamanRunner implements Runnable { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); }finally { System.out.println("hahhhhh"); } } } } ```