🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 以下两种情况不会运行 #### 中止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"); } } } } ```