Chapter 5. Lists, Logic, and Loops

If you wrote a Java program with what you know so far, it would likely be a little dull. If you wrote a Java program with what you know so far, it would likely be a little dull. That last sentence isn't repeated twice because of an editorial mistake. It is a demonstration of how easy computers make it to repeat the same thing over and over. You learn today how to make part of a Java program repeat itself by using loops.

Additionally, you learn how to make a program decide whether to do something based on logic. (Perhaps a computer would decide it isn't logical to repeat the same sentence twice in a row in a book.)

You also learn how to organize groups of the same class or data type into lists called arrays.

First ...

Get Sams Teach Yourself Java™ 2 Platform in 21 Days Professional Reference Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.