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:

  • String Concatenation:String Con:catenation Here is a small java program to demonstrate String Concatenation: package stringdemo; public class StringConcat {   &nbs… Read More
  • equals() and equalsIgnoreCase()String Comparision: The String class includes many methods that compares Strings or Substrings within strings. equals() and equalsIgnoreCase() pac… Read More
  • equals() Versus ==equals() Versus == We should be clear that equals() method and == operator perform two different operations.The equals() method compares the characte… Read More
  • String Concatenation with other data typeString Concatenation with other data type: package stringdemo; public class StringS {     public static void main(String[] args) {  … Read More
  • The String Constructor:The String Constructor: //Construct one String from other class MakeString{ public Static void main(String[] args){ Char c[]={'d','o','g'}; String s… Read More

0 comments:

Post a Comment