previous | start | next

## Reading Input

- Read console input from System.in
- System.in is an InputStream: reads bytes
- We want a Reader that reads characters
- Turn System.in into InputStreamReader
- Also want to read entire lines
- Use BufferedReader:

      BufferedReader console = new BufferedReader(

         new InputStreamReader(System.in));

      System.out.println("How old are you?");

      String input = console.readLine();

      int age = Integer.parseInt(input);

- #### Ch1/input2/InputTest.java

previous | start | next