continue is able to skip out of multiple levels of loop. : continue « Statements « SCJP






public class MainClass {
  public static void main(String[] argv) {
    char[][] array = new char[][] { { 'a', '\u0000', 'v', }, { 'd', 'e', 's', } };

    mainLoop: for (int i = 0; i < array.length; i++) {
      for (int j = 0; j < array[i].length; j++) {
        if (array[i][j] == '\u0000') {
          continue mainLoop;
        }
        System.out.println(array[i][j]);
      }
    }

  }
}
a
d
e
s








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