Chapter 19
Out of Many, One
IN THIS CHAPTER
Using for loops to the max
Storing many values in a single variable
Working with groups of values
This chapter has nine illustrations. For these illustrations, the people at Wiley Publishing insist on the following numbering: Figure 19-1, Figure 19-2, Figure 19-3, Figure 19-4, Figure 19-5, Figure 19-6, Figure 19-7, Figure 19-8, and Figure 19-9. But I like a different kind of numbering. I’d like to number the illustrations figure[0]
, figure[1]
, figure[2]
, figure[3]
, figure[4]
, figure[5]
, figure[6]
, figure[7]
, and figure[8]
. In this chapter, you find out why.
Some Loops in Action
The Java Motel, with its ten comfortable rooms, sits in a quiet place off the main highway. Aside from a small, separate office, the motel is just one long row of ground-floor rooms. Each room is easily accessible from the spacious front parking lot.
Oddly enough, the motel's rooms are numbered 0 through 9. I could say that the numbering is a fluke — something to do with the builder’s original design plan. But the truth is, starting with 0 makes the examples in this chapter easier to write.
You, as the Java Motel’s manager, store occupancy data in a file on your ...
Get Beginning Programming with Java For Dummies, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.