A scanner in Java is a command in Java that will read an input for the program. In other words, it scans the input.

The input could be:

  • From the user of the program (ex. when someone is playing presses the arrows to move.)
  • From another file. The program is linked to another file; the program reads that file.
  • From the programmer himself. You could use the scanner to split rows and to get parts of a String.


Click here to find out when do you have to use the scanner.
Click here for different methods in the scanner class.