do while loop in java, Important Example

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

1371

Program:

 public class DoWhileLoop {

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

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

  

Output:

Java do while loops:1
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.