import java.util.Scanner; /** Input.java - Let's practice simple interactive (standard) input. */ public class Input { public static void main(String [] args) { Scanner kbd = new Scanner(System.in); System.out.print("Give me an integer: "); int n = kbd.nextInt(); System.out.println("You entered " + n); System.out.print("Let's try a real number: "); double x = kbd.nextDouble(); System.out.println("You entered " + x); // We must throw away the \n so that we can now read a string. kbd.nextLine(); System.out.print("Give me a line of text: "); String line = kbd.nextLine(); System.out.println("You entered '" + line + "'"); } }