import javax.swing.JOptionPane; public class MainClass { public static void main(String[] args) { String s; s = JOptionPane.showInputDialog("Enter an integer:"); int x = Integer.parseInt(s); System.out.println("You entered " + x + "."); } }