1 /*--------------------------------------------------------------------------*/ 2 /* File name : err9.java */ 3 /* : */ 4 /* Cause : When I use "labeled continue" in "for"statement, error */ 5 /* : */ 6 /* Message : In class `err9': */ 7 /* : In method `main(java.lang.String[])': */ 8 /* : 22: `continue' must be in loop. */ 9 /* : continue movehere; */ 10 /* : ^ */ 11 /* : 1 error */ 12 /*--------------------------------------------------------------------------*/ 13 14 public class err9 { main(String[] args)15 public static void main(String[] args) { 16 int y = 0; 17 18 movehere: for ( int x = 0; x < 10; x++ ) { 19 if ( x > 2 ) { 20 continue movehere; 21 } 22 y++; 23 } 24 25 if ( y == 3 ) { 26 System.out.println("OK"); 27 } else { 28 System.out.println("NG:[3]-->[" +y+ "]"); 29 } 30 } 31 } 32 33