True and False
All conditional statements use the true or false of the conditional expression to determine the execution path.
If-else
if (boolean-expression)
Statement
Or
if (boolean-expression)
Statement
Else
Statement
Iteration
While, Do-while and for to control loops, sometimes they are divided into iteration statements (iteration statement). The statement is repeated until the Boolean expression (booleanexpression) that controls the action gets the result of "false".
While loop
while (boolean-expression)
Statement
Do-while Cycle
Do
Statement
while (boolean-expression)
For loop
for (initialization; Boolean-expression; Step
Statement
Enhanced for
Used for arrays and containers, such as:
For (String s:new string[] {"1", "2"})
Statement
Loop control:
return break continue
Switch
Switch (selector) {
Case Value1:statement; Break
Case Value2:statement; Break
Case Value2:statement; Break
// ...
Default:statement;
}
Where the selection factor selector, can be shaping, enum, String (added after jdk1.7)
This article is from the "Small City Ops" blog, please be sure to keep this source http://lixcto.blog.51cto.com/4834175/1887446
Java Programming Thought study notes-fourth chapter control the execution process