5.12. Wrap-Up

In this chapter, we completed our introduction to Java’s control statements, which enable you to control the flow of execution in methods. Chapter 4 discussed Java’s if, if...else and while statements. The current chapter demonstrated Java’s remaining control statements—for, do...while and switch. We showed that any algorithm can be developed using combinations of the sequence structure (i.e., statements listed in the order in which they should execute), the three types of selection statements—if, if...else and switch—and the three types of repetition statements—while, do...while and for. In this chapter and Chapter 4, we discussed how you can combine these building blocks to utilize proven program-construction and problem-solving ...

Get Java™ How to Program, Seventh 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.