import javax.swing.*;
class Exampler
{
public static void main
(String []args)
{
String name =
JOptionPane.showInputDialog("What is your name?");
JOptionPane.showMessageDialog(null, "Your name is"+name);
}
}
Note that the data entered is by default a string. If you need to perform
calculations on the result then it must be converted using the parse methods
(Integer.parseInt, Double.parseDouble, etc.)