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