Computer Applications
What are the unique features of for loop?
Java Iterative Stmts
31 Likes
Answer
for loop is an entry-controlled loop. Its general syntax is as follows:
for (initialization; conditional; increment/decrement)
{
//Java Statements
..
..
}
- The initialization expression initializes the loop control variable and is executed only once when the loop starts. It is optional and can be omitted by just putting a semicolon.
- The conditional expression is tested at the start of each iteration of the loop. Loop will iterate as long as this condition remains true.
- The increment/decrement expression updates the loop control variable after each iteration.
- The body of the loop that consists of the statements that needs to be repeatedly executed.
Answered By
14 Likes