AP® Computer Science A glossary
Scanner (file input)
Also called: Scanner
Course: AP® Computer Science A Shows up in: Unit 4: Data Collections
The java.util class that reads data from a file: Scanner(File f) with nextInt, nextDouble, nextBoolean, next, nextLine, hasNext and close.
Appears in the course and exam description (CED): 4.6.A.64.6.A.74.6.A.94.6.A.10
next, nextInt, nextDouble and nextBoolean read one token (text up to whitespace); a token of the wrong type throws an InputMismatchException. nextLine reads the rest of a line. hasNext returns true while there is more to read. Keyboard input is outside the scope of the AP® exam.