Why is it allowed to label almost every statement in Java? -


i understand main purpose of labels use them break , continue alter usual behaviour of loop. it's possible label every statement not declaration.

int j = 0; label1: j++; label2: (int = 0; < 4 ; i++) {     if (i == 3) break label2; } 

is there purpose labels label1 since it's not allowed break label1?

an unreleased version of java used have goto. in order jump statement goto, have able label it.

then @ point james gosling decided wasn't feature , ripped out. involved grepping through java code existed @ time , rewriting goto usage; there 13 uses. (source: youtube video)

so, goto still being reserved word, it's remnant of goto support.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -