Chapter Three – Input and Output


Chapter three introduces the System class, packages, and Java libraries. It also teaches you how to use the Scanner class to read user’s input from standard input (

Note that the exercises presented here also introduce another common way to obtain user’s input through parameters passed to a class’s main method. Both techniques are equally valid; however, the Scanner class is for interactively capturing user input while command-line parameters are passed to a program at startup. This difference is demonstrated in the exercise on the Scanner class.

Chapter Slides
Try It – Step by Step