O'Reilly logo

Sams Teach Yourself Java™ 2 Platform in 21 Days Professional Reference Edition by Rogers Cadenhead, Laura Lemay

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

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