// class5_InputString.java: Entering input from input dialog boxes import javax.swing.JOptionPane; public class InputString { public static void main(String args[]) { // Prompt the user to enter a name: String name1 = JOptionPane.showInputDialog(null, "What is your name?", "Input Window: for a String", JOptionPane.QUESTION_MESSAGE); // Display the result in a message dialog box JOptionPane.showMessageDialog(null, "Thank you, " + name1, "Input Window Demo", JOptionPane.INFORMATION_MESSAGE); System.out.println("The name entered was: " + name1); System.exit(0); } }