SE450: Reading Input [36/53] Previous pageContentsNext page

file:horstmann/ch01_input/InputTester.java [source] [doc-public] [doc-private]
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
package horstmann.ch01_input;
import java.util.Scanner;

public class InputTester
{
  public static void main(String[] args)
  {
    Scanner in = new Scanner(System.in);
    System.out.print("How old are you?");
    int age = in.nextInt();
    age++;
    System.out.println("Next year, you'll be " + age);
    in.close();
  }
}

Previous pageContentsNext page