| A statement: | assignment; |
| A block: | {assignment; assignment; ... }
|
if(boolean condition)
statement; or {block}
else
statement; or {block}
|
An else is always bound to the most recent if. |
switch x {
case A: statement; or {block} //fall through
case B: statement; or {block} //fall through
case C: statement; or {block} break; //skip default
default: statement; or {block}
while(condition) statement; or {block}
do statement; or {block} while(condition)
for(initializers; condition; incrementers)
statement; or {block}
label: statement; or {block}
break; | exit the inner-most block in which it occurs |
break label; | exit the labelled block called label |
continue; | immediately start the next pass of the inner-most loop |
continue label; | immediately start the next pass of the labelled loop |
return; | return from the current method to its caller |
return(x); | return from the current method, passing the value of x to its caller. The type of x must be the return type declared for this method. |
NOTE: There's no goto statement in Java because break and continue can express more formally what goto is used for in other languages.