Control flow in Java is very similar to that in C and C++.
if (boolean-expression) statement1 else statement2Unlike in C the boolean expression must really be boolean, not integer.
for (init-expr; boolean-expr; incr-expr) statementThe init and incr expressions are a rare case where the "," operator is allowed in Java. The three expressions are optional so for (;;) is allowed.. The condition in the for loop must be boolean.
int i, j; outer: for (i=0; i<100; ++i) { for (j=0; j<100; ++j) { // ... break; /* break out of inner loop */ // ... break outer; /* break out of outer loop */ // ... continue outer; /* continue outer loop */ // ... } // ... break; /* break out of outer loop */ // ... }