Java Reference
In-Depth Information
Looping statements in java
Sometimes there is a need to execute a block of statements several times depending on any
condition. This type of situation is handled by Loops in java.
Java allows these loops mechanisms with three types of loops:
 for Loop
 while Loop
 do...while Loop
The for Loop
A for loop is a control structure which executes the statements within this IF block several
times depending on conditions.
A for loop is beneficial when we already know for how many times to repeat a particular
for (initialization ; Boolean_expression ; update)
//body for the loop
Sequence of steps followed in a for loop:
 First of all initialization statement is executed. This statement allows declaring
or initializing loop control variables.
 Now the Boolean expression or test condition is evaluated. If this Boolean
expression comes to true, the defined body of the for loop is executed. Otherwise
Search WWH ::

Custom Search