While Loop in java, Print 1 to 10

Java Programming Language / Decision Making and Looping in java

32210

Program:

 public class WhileLoopExample {
	public static void main(String[] args)
	{
    int i=1;
   		 while(i<=10)
   		 {
      	   System.out.println(i);
    		i++;
    	 }
	}
}

  

Output:

1
2
3
4
5
6
7
8
9
10
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.