A Program that Uses the JOptionPane Class to Get User Input
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 + "."); } }