- ★★Java質問・相談スレッド177★★©2ch.net
826 :デフォルトの名無しさん[]:2016/06/05(日) 19:14:01.58 ID:/bruxSbe - >>824
14.16. The continue Statement http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.16 | The scope of a label of a labeled statement is the immediately contained Statement. | The continue target must be a while, do, or for statement, or a compile-time error occurs. ラベルのスコープはラベル直後のステートメント continueの対象はwhile, do, forに限る ちゅうことなんでラベルは貼れても飛ぶことができないかと こういうのだったらできるんだけどねー int i = 0; Label_1: while (i < 3) { Label_2: while (true) { if (i % 2 == 0) { i++; continue Label_1; } else { i++; continue Label_2; } } }
|