Tuesday, December 22, 2015

Java break statement:

Java break statement:

package javaapplication27;


public class BreakDemo {
    public static void main(String[] args) {
        for(int i=0;i<=100;i++){
        if(i==10)break;         //break loop if i is 10;
            System.out.println("i"+i);
        }
        System.out.println("loop complete.");
    }
}


The output  of this program is:
run:
i0
i1
i2
i3
i4
i5
i6
i7
i8
i9
loop complete.


Related Posts:

  • String Concatenation with other data typeString Concatenation with other data type: package stringdemo; public class StringS {     public static void main(String[] args) {  … Read More
  • 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
  • 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