You are here: Home / Topics / Simple for loop example in Java

Simple for loop example in Java

Filed under: Java on 2023-08-18 06:35:54

Here we have made a simple for loop example in Java.

// Simple for loop example

public class ForLoop{

   public static void main(String[] args) {

       for (int i = 0; i < 5; i++) {
           System.out.println("Loop : "+i);
       }
   }
}


Output:

Loop : 0
Loop : 1
Loop : 2
Loop : 3
Loop : 4

About Author:
Y
Yatendra Sir     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.