for loop in java, different way

Java Programming Language Decision Making and Looping in java (Article) Decision Making and Looping in java (Program)

4227

Program:

 public class ForLoop {

    public static void main(String args[]) {
        /* local variable Initialization */
        int n = 1, times = 5;

        /* for loops execution */
        for (n = 1; n <= times; n = n + 1) {
            System.out.println("Java for loops:" + n);
        }
    }
}

Output:

Java for loops:1
Java for loops:2
Java for loops:3
Java for loops:4
Java for loops:5
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.