java - SCJP with label -
below compilation fail due "label z missing" if move z: 1 step below after o = o + 2 work? logic behind this?
public class breaker { static string o = ""; public static void main(string[] args) { z: o = o + 2; (int x = 3; x < 8; x++) { if (x == 4) break; if (x == 6) break z; o = o + x; } system.out.println(o); } }
you cannot put labels anywhere in code. should before statements. in case labelname: for(;;){}
here's documentation
Comments
Post a Comment