Reading Input
- Construct Scanner
from input stream (e.g. System.in)
Scanner in = new
Scanner(System.in)
- nextInt,
nextDouble
reads next int
or double
int n = in.nextInt();
- hasNextInt,
hasNextDouble
test whether next
token is a number
- next
reads next string (delimited by whitespace)
- nextLine
reads next line