Scanner
classNot covered on the AP exam
The new Scanner
class, in java.util, is a more
convenient alternative to BufferedReader
.
Before, if you wanted to read an integer from the user, you
would have to write the following.
Now you can instead write:BufferedReader in = new BufferedReader(System.in); int n = Integer.parseInt(in.readLine());
Scanner in = new Scanner(System.in); int n = in.nextInt();
Like anything related to I/O, this isn't on the AP exam. But it is
quite a bit more convenient than BufferedReader
s, so some
textbooks will switch to using it.