O'Reilly logo

THE Java™ Programming Language, Fourth Edition by James Gosling, Ken Arnold, David Holmes

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 10. Control Flow

 

“Would you tell me, please, which way I ought to go from here?” “That depends a good deal on where you want to get to.”

 
 --Lewis Carroll, Alice in Wonderland

A program consisting only of a list of consecutive statements is immediately useful because the statements are executed in the order in which they're written. But the ability to control the order in which statements are executed—that is, to test conditions and execute different statements based on the results of the tests—adds enormous value to our programming toolkit. This chapter covers almost all the control flow statements that direct the order of execution. Exceptions and assertions are covered separately in Chapter 12.

Statements and Blocks

The two basic statements ...

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