Java provides three different types of iteration statements: for, while, and do. It also provides the continue statement to alter execution of for, while, and do. These statements, taken from C and C++, are used to repeat the execution of a statement or block of statements until a termination condition occurs.
The for statement repeatedly executes a statement or statement block and updates a variable (or group of variables) with each loop iteration. The syntax of the for statement is as follows:
for(initialization; boolean expression; iteration) statement block
A single statement can be used instead of the statement block. The execution of the for statement is executed as follows:
The initialization statement(s) ...