Skip to content Skip to sidebar Skip to footer

Labeled Break Ignored Or Treated As Normal Break

My target platform is Android. Seems I can't make a labeled break execute even once. What am I missing? It appears Android treated the last labeled break as a normal break, else

Solution 1:

Your output is correct for the code you've provided. From your post, it sounds as though you're expecting control flow to be transferred to the label. This is not the case in Java.

Per the Java docs:

The break statement terminates the labeled statement; it does not transfer the flow of control to the label. Control flow is transferred to the statement immediately following the labeled (terminated) statement.

Post a Comment for "Labeled Break Ignored Or Treated As Normal Break"