O'Reilly logo

Java Gently, Third Edition by Judith Bishop

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Input and output

Input and output

4.1 Inputting interactively

4.2 User-friendly input–output

4.3 Creating and accessing packages

4.4 Selection with if-else

4.5 File input and output

4.6 Handling exceptions

In this chapter we focus on input and output and introduce two custom-made Java classes that give a simple yet powerful means of interacting with a program. By being able to read in values to a program, we change its state. Two other ways of changing the state are by means of explicit selection (the if-statement) and reacting to exceptions. Using the IO classes both on the screen and with files requires that we know how to create and use packages, which is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required