Beruflich Dokumente
Kultur Dokumente
3 4
1
Input Dialogs The System.exit() Method
String name;
name = JOptionPane.showInputDialog( • A program that uses JOptionPane does
"Enter your name."); not automatically stop executing when the
• The argument passed to the method is the message end of the main method is reached.
to display.
• If the user clicks on the OK button, name references • Java generates a thread, which is a
the string entered by the user. process running in the computer, when a
• If the user clicks on the Cancel button, name JOptionPane is created.
references null.
• If the System.exit method is not called, this
thread continues to execute.
7 8
9 10