Looping with for in Java


for loops are useful for iterating a set number of times.

Source Code

public class ForLoopExample {
    public static void main(String[] args) {
        for (int i = 1; i <= 5; i++) {
            System.out.println("Value of i: " + i);
        }
    }
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments