Controlling the Flow of Your Program
Bart Baesens, Aimée Backiel, Seppe vanden Broucke · 2012
This chapter discusses two types of control operators, comparative and logical, that are used frequently in Java control structures. The syntax for operators will differ whether the data type is primitive or composite. Primitive types include char, Boolean , and many numeric representations, like int, double, and float. Arrays, strings, and other defined classes are composite data types. The chapter explores how comparison operators and methods can be used in Java control structures. These structures include for and while loops, if-then statements, and switches. While each situation may be better suited to one type of structure, in fact, they are usually interchangeable as they function much the same way using different constructs. The chapter explains each of these structures independently and also compares and contrasts them. The chapter also focuses on break, continue, and return, which are more general and can be found in different kinds of structures.