// DIS's super-duper simplified version of code for obtaining user-input. // Spring 2001 // Load Java's I/O facilities: import java.io.*; public class UserIO { // $main$ must "throw" an exception if input is illegal: public static void main(String[] args) throws IOException { // Create object $in$ that allows you to prompt user for input: BufferedReader in = new BufferedReader (new InputStreamReader(System.in)); // Read strings: System.out.print("Enter a string: "); String s = in.readLine(); System.out.println("You entered "+s); // Enter integer: System.out.print("Enter an integer: "); int n = Integer.parseInt(in.readLine()); System.out.println("You entered "+n); // Enter double: System.out.print("Enter a double: "); double x = Double.valueOf(in.readLine()).doubleValue(); System.out.println("You entered "+x); } }