java for loop example program

java for loop example program

java for loop which executes group of statements repeatedly until a particular condition is true.

java for loop structure

//group of statements
  • the initialization expression initializes the loop means we will declare ad perform the initialization for the varialbles.
  • the initialization section will be executed only once. and in this section we can declare multiple variables of same data type.
  • we can take any java expression as condition and here result should be boolean type. when the condition fails the for loop will terminate.
  • the increment/decrement section is invoked after each iteration of loop inthissectiin we will increment or decrement the variable value.


public class ForLoopDemo{
public static void main(String[] args){
for(int i = 0;i<=15;i++){
System.out.println("The Integer count is :"+i);