I was looking at the source code for the class String for 8u40-b25 JDK, and it contains a scan: {}
block:
2557 /* Now check if there are any characters that need to be changed. */
2558 scan: {
2559 for (firstUpper = 0 ; firstUpper < len; ) {
2560 char c = value[firstUpper];
2561 if ((c >= Character.MIN_HIGH_SURROGATE)
2562 && (c <= Character.MAX_HIGH_SURROGATE)) {
2563 int supplChar = codePointAt(firstUpper);
2564 if (supplChar != Character.toLowerCase(supplChar)) {
2565 break scan;
2566 }
2567 firstUpper += Character.charCount(supplChar);
2568 } else {
2569 if (c != Character.toLowerCase(c)) {
2570 break scan;
2571 }
2572 firstUpper++;
2573 }
2574 }
2575 return this;
2576 }
What does this mean?
scan
is just a label. It allow this later on:
break scan;
... to allow the break
statement to break out of the outer loop instead of the inner loop.
See section 14.7 of the JLS for more details of labeled statements.
See more on this question at Stackoverflow