在一个程序中,如果我们保留system.exit(0),将会发生什么以及控制台输出是什么



我有一个类似的程序

class A {
    public void test1(String s1) {
        try {
            System.exit(0);
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            System.out.println("from finally");
        }
    }
    public void test2(String s2) {
        // some text.....
    }
}

在以下级别的中

class Manager {
    public static void main(String[] args) {
        A a1 = new A();
        a1.test1("test1");
        a1.test2("test2");
    }
}

我想在调用a1.test1后得到程序流程的详细答案控件将进入Manager类中的a2.test2或任何其他?请澄清我的疑虑。

一旦点击System.exit(0),程序就完成了。它终止了。

最新更新