I'm able to compile and run the following code fragment, but I can't add any further code to it, in order to utilise the labelled statement. Consequently, am I right in thinking that there is no logical use for such a statement? (Java allows me to do this, which is why I ask.)
statement: System.out.print("This represents a \'standalone\' statement.");
Also, I'm learning Java, and discovered (just for some "trivial fun" only) that Java allows the following code fragments to compile OK.
labelID: System.out.println("Label identifiers are allowed to be - ");
labelID: System.out.println("the same.");
// Labels can be "chained together", and you can "break out of" any of them.
label1:
label2:
label3: break label1; // Can be break label1, 2, or 3.
// Labels can be associated with "null statements"
label: {}
label: ;