I always thought that the labels must be used only with loops but it seems not. Giving such code:
public class LabelTest {
public static void main(String
It does not compile. Good question! I have just played a little bit with your code snippet. It seems that compiler expects method call or operator after label. It does not allow assignment at this point.
I think that the fact that label is not forbidden before operators other than for, while and do is probably a bug (?!) of java compiler of specification. Anyway it is not so critical. It does not bother me (personally).