Java Simple While Loop



User Rating:  / 0
PoorBest 
Details
Category: Java
Created on Thursday, 08 November 2012 09:43
Last Updated on Thursday, 08 November 2012 09:43
Published on Thursday, 08 November 2012 09:43
Written by Administrator
Hits: 5830

Simple While Loop example in Java :

View source
package com.developerpages.snippets.basics;
 
public class SimpleWhileLoopExample {
 
    public static void main(String[] args) {
        int i = 0;
        int max = 10;
 
        System.out.println("Loop " + max + " times");
 
        while (i < max) {
            i++;
            System.out.println("i is : " + i);
        }
 
    }
}