JFrame.dispose() vs System.exit()
问题 What is the difference between these two methods - System.exit() and JFrame.dispose() ? If we want to close a Java Swing application when a button is clicked, which method should I use? 回答1: System.exit(); causes the Java VM to terminate completely. JFrame.dispose(); causes the JFrame window to be destroyed and cleaned up by the operating system. According to the documentation, this can cause the Java VM to terminate if there are no other Windows available, but this should really just be seen