• Aselection control statement is used to alter the sequential flow of control.
• The if and switch statements are two types of selection control.
• The two versions of the if statement are if–then–else and if–then.
• Aboolean expression contains conditional and boolean operators and
evaluates to true or false.
• Three boolean operators in Java are AND (&&), OR (||), and NOT (!).
• DeMorgan’s laws state !(P &&Q) and !P || !Q are equivalent and !(P || Q) and
!P && !Q are equivalent.
• Logical operators && and || are evaluated by using the short-circuit
evaluation technique.
• Aboolean flag is useful in keeping track of program settings.
• An if statement can be a part of the then or else block of another if statement
to formulate nested if statements.
• Careful attention to details is important to avoid illogically constructed
nested if statements.
• When the equality symbol == is used in comparing the variables of reference
data type, we are comparing the addresses.
• The switch statement is useful for expressing a selection control based on
equality testing between data of type char, byte, short, or int.
• The break statement causes the control to break out of the surrounding switch
statement (note: also from other control statements introduced in Chap. 6).
• The standard classes introduced in this chapter are:
java.awt.Graphics java.awt.Point
java.awt.Color java.awt.Dimension
• The java.awt.Graphics class is used to draw geometric shapes.
• The java.awt.Color class is used to set the color of various GUI components.
• The java.awt.Point class is used to represent a point in two-dimensional space.
• The java.awt.Dimension class is used to represent a bounding rectangle of
geometric shapes and other GUI components.