Controlling the Flow of Execution

Controlling the flow of execution is perhaps the most important aspect of any programming language. Control flow allows you to direct the execution of your program down different paths in response to the inputs to your system. A proper construction of loops and branches in your code provides your program a map to follow as it performs its work.

You can also think about control flow like a stoplight. The logic in a traffic system directs the flow of traffic based on the current conditions and the timing mechanism that drive it. Your programs must also have the capability to start, stop, and direct their flow of execution. Without the variety of control constructs found in modern programming languages, you would ...

Get Special Edition Using Java 2 Standard 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.