java.util · java.base · since Java 1.5
Scanner
public final class Scanner implements Iterator<String>, CloseableTokenizing text parser over any source: nextInt/nextLine/hasNext, regex-delimited. The standard beginner input tool with one famous newline gotcha.
Key methods
boolean hasNextInt() / int nextInt() | Typed token pairs — test then read. |
String nextLine() | Rest of the current line. |
Scanner useDelimiter(String pattern) | Custom token boundaries. |