Loading topic
System.in. This chapter explains what System.in is, how bytes typed at a terminal reach your program, and what behaviors of the stream cause problems later when you wrap it in a Scanner or ot7 min readString, int and exceptions are. Here you will create a java.util.Scanner on standard input, see what it does internally, and learn the constructi6 min readScanner on System.in (the previous chapter) and how try/catch works. This chapter covers the token methods: next, nextInt, nextDouble and their relatives. You will learn how they split input, how they convert text to values, and which errors they p5 min readString, loops and try/catch. It also assumes you have created a Scanner on System.in and read single tokens with next and nextInt.5 min readScanner on System.in and know the difference between nextInt() and nextLine(). It also assumes you can run a Java file from the command line. Here you will see why mixing the two calls gives surprising results. You will also see three ways to fix it and 6 min readScanner signals the end of input, how to write loops that stop cleanly, and what goes 6 min readScanner on System.in and read tokens and lines from it. It also assumes you know try-with-resources and the exceptions NoSuchElementException and IllegalStateException. Here you will learn what Scanner.close() does to System.in, why that matters, and6 min readString, int, and try/catch. It also assumes you have read the earlier chapters on Scanner and the leftover newline pitfall. You need JDK 25 or later to run the examples.5 min readScanner (see the earlier chapters on Scanner, the leftover newline, and end of input). It also assumes you can compile and run a Java program from a terminal and that you know how try/finally works. The chapter covers java.io.Console, the class 6 min readScanner, read tokens with next and nextInt, and read lines with nextLine. It also assumes you know the leftover newline pitfall and basic regular expressions: character classes, *, + and |.6 min readScanner, the leftover newline pitfall, and end of input. It also assumes you know checked exceptions and try-with-resources. Here you will read console input with java.io.BufferedReader, the standard library's older, lower-level option. 6 min readScanner, java.io.Console, java.io.IO (Java 25) and BufferedReader. It assumes you have read the earlier chapters on each of them. You should be comfortable with hasNextInt, the leftover newline, end of inpu5 min read