Java examples for Language Basics:Hello World
Getting Input with the JOptionPane Class
import javax.swing.JOptionPane; public class DialogApp { public static void main(String[] args) {/*from w w w .jav a 2 s . com*/ String s = JOptionPane.showInputDialog("Enter an integer:"); int x = Integer.parseInt(s); System.out.println("You entered " + x + "."); } }