Yes. Our new program will do this.
Let us write a program:
ActionListener
.actionPerformed()
method.
actionPerformed()
method calls System.exit(0)
.static main()
method.
Often a real application has several ways to quit: the window's close button, a menu selection, and perhaps a button like this program.