For Loop Java
For Loop in Java
Syntax:
for (initialization;condition;increment/decrement) { ……; } |
Description :
Starts the loop with the initialization expression, executes the set of statements and proceeds the increment/decrement. Process repeats until the condition fails.
Example:
for (int i=0;i<5;i++){ System.out.println(“Print 5 times”); } |
Output:
Print 5 times
Print 5 times Print 5 times Print 5 times Print 5 times |