In a console program, it is common to read from the standard input, typically the command line. In this phrase, we show how you can read the standard input into a Java String variable. Java contains three streams that are connected to the operating system streams. These are the standard input, standard output, and standard error streams. Respectively, they are defined in Java as the streams System.in, System.out, and System.err. We can make use of these streams to read or write to the operating systems standard input and output. In our phrase, we create a BufferedReader to read from the System.in stream. Using this reader, we continue to read input lines from the standard input until the user types the word "quit." |