To ensure that a Java GUI application exits properly when its main window is closed, simply use this statement

LANGUAGE: Java

CHALLENGE:

To ensure that a Java GUI application exits properly when its main window is closed, simply use this statement

SOLUTION:

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);