Java Control Structures - For Loop

March 24, 2018 Oclemy Java Control Structures 0 minutes, 39 seconds

A loop is a statement that allows us execute a given block of code over and over again for a specific number of times.

Loops are fundamental to programming so Java supplies a powerful assortment of looping constructs.

The most versatile of them is the for loop.

The syntax for loop is:

for(initialization; condition; iteration){

The initialization part initializes a loop control variable to an initial value. The condition is a Boolean expression that tests the loop control variable. If the outcome of that test is true then the for loop continues to iterate. However if it evaluates to false the loop will terminate and move control to the next statement after the loop.

The iteration expression determines the how the loop control is changed each time the loop iterates.