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 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.