1.2 and Reserved Words 绪Keyword 论The following are keywords used to control the flow through a block of code: if Used to perform a logical test for true or false. else Executes an alternate block of code if an if test is false. switch Indicates the variable to be compared with the case statements. case Executes a block of code, dependent on what the switch tests for. default Executes this block of code if none of the switch-case statements match. for Used to perform a conditional loop for a block of code. while Executes a block of code repeatedly while a certain condition is true. do Executes a block of code one time, then, in conjunction with the while statement, it performs a test to determine whether the block should be executed again.
Java Programming, spring, 2012