Friday 15 January 2010

syntax - labels used on ordinary method calls - Java -



syntax - labels used on ordinary method calls - Java -

i aware of labels in java utilize loops such as:

myloop: for(;;) { // codez break myloop; }

but recenlty found out valid:

mylabel: system.out.println("");

why 1 want that? utilize of (if any)?

the label @ top of command construction causes execution resume @ end of command construction 1 time break myloop; called.

putting label on line doesn't precede command construction doesn't anything. there's no point, @ to the lowest degree it's harmless.

labels described here in java language specification. there's nil stopping putting label on statement. maybe java's designers didn't want restrict statements labeled if introduced new command construction wouldn't have add together set of statements can labeled.

java syntax

No comments:

Post a Comment