Tuesday, December 22, 2015

java while loop

java while loop
package javaapplication27;


public class WhileloopDemo {
    public static void main(String[] args) {
        int n=10;
       
        while(n>0){
            System.out.println("go"+n);
            n--;
        }
    }
}

The output is :
run:
go10
go9
go8
go7
go6
go5
go4
go3
go2
go1


Related Posts:

  • length() and capacity() method StringBuffer: length() and capacity() The length of the StringBuffer can be found by the length() method.while the total capacity can be found th… Read More
  • replace() method Modifying a String: replace();     The replace method is used to replace the one character of string.It has the general form:   &nbs… Read More
  • Java program to show number pyramid Number Pyramid: package diamond; public class PyramidDemo {     public static void main(String[] args) {         for… Read More
  • Character Extraction Character Extraction: 2)getChars() If you want to extract more than one character at a time,you can use the getChars() method. It has general form… Read More
  • Fibonacci Using Recusion method Fibonacci Using Recusion method: package diamond; import static diamond.Fibonacci.fibonacciRecusion; public class FibonacciDemo {     pu… Read More

0 comments:

Post a Comment