Control Structures
}Sequential execution: Statements in a program execute oneafter the other in the order in which they are written.
}Transfer of control: Various Java statements, enable you tospecify that the next statement to execute is not necessarily the next one insequence.
}Bohm and Jacopini
§Demonstrated that programs could be written without any goto statements.
§All programs can be written interms of only three control structures—the sequencestructure, the selection structure and the repetitionstructure.
}When we introduce Java’s control structure implementations, we’ll refer to them in the terminology of the Java Language Specification as“control statements.”
Three types of selection statements.
}if statement:
§Performs an action, if a conditionis true; skips it, if false.
§Single-selection statement—selects or ignores a single action (or group of actions).
}if…else statement:
§Performs an action if a conditionis true and performs a different action if the condition is false.
§Double-selection statement—selects between two different actions(or groups of actions).
}switch statement
§Performs one of several actions,based on the value of an expression.
§Multiple-selection statement—selects among many different actions (orgroups of actions).
}Three repetitionstatements (also called looping statements)
§Perform statements repeatedly while a loop-continuation condition remains true.
}while and for statements perform the action(s) in their bodies zero or more times
§if the loop-continuation condition isinitially false, the body will not execute.
}The do…while statement performs the action(s) in itsbody one or more times.
}if, else, switch, while,do and for are keywords.

