O'Reilly logo

The Java® Language Specification, Java SE 7 Edition, Fourth Edition by Alex Buckley, Gilad Bracha, Guy Steele, Bill Joy, James Gosling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required