import java.util.Scanner; /** Input.java - Let's practice simple interactive (standard) input. * But now let's just use nextLine() for everything. */ public class Input2 { public static void main(String [] args) { Scanner kbd = new Scanner(System.in); System.out.print("Give me an integer: "); int n = Integer.parseInt(kbd.nextLine().trim()); System.out.println("You entered " + n); System.out.print("Let's try a real number: "); double x = Double.parseDouble(kbd.nextLine().trim()); System.out.println("You entered " + x); System.out.print("Give me a line of text: "); String line = kbd.nextLine(); System.out.println("You entered '" + line + "'"); } }