14.7. Labeled Statements

Statements may have label prefixes.

LabeledStatement:    Identifier : StatementLabeledStatementNoShortIf:    Identifier : StatementNoShortIf

The Identifier is declared to be the label of the immediately contained Statement.

Unlike C and C++, the Java programming language has no goto statement; identifier statement labels are used with break14.15) or continue14.16) statements appearing anywhere within the labeled statement.

The scope of a label of a labeled statement is the immediately contained Statement. It is a compile-time error if the name of a label of a labeled statement (§14.7) is used within the scope of the label as a label of another labeled statement.

There is no restriction against using the same identifier ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.