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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -