Both the break statement and the continue statement can be unlabeled or labeled. : continue « Statements « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Statements » continue 
5.6.1.Both the break statement and the continue statement can be unlabeled or labeled.
public class MainClass{
    public static void main(String[] argv){
        boolean isTrue = true;
        outer:
          for(int i=0; i<5; i++) {
            while (isTrue) {
              System.out.println("Hello");
              break outer;
            // end of inner while loop
            System.out.println("Outer loop.")// Won't print
          // end of outer for loop
        System.out.println("Good-Bye");

    }
}
Hello
Good-Bye
5.6.continue
5.6.1.Both the break statement and the continue statement can be unlabeled or labeled.
5.6.2.continue with label
5.6.3.The continue statement terminates the current pass through a loop.
5.6.4.continue is able to skip out of multiple levels of loop.
5.6.5.Using a Labeled Continue Statement
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.