14.15. The break Statement
A break
statement transfers control out of an enclosing statement.
BreakStatement: break
Identifieropt ;
A break
statement with no label attempts to transfer control to the innermost enclosing switch
, while
, do
, or for
statement of the immediately enclosing method or initializer; this statement, which is called the break target, then immediately completes normally.
To be precise, a break
statement with no label always completes abruptly, the reason being a break
with no label.
If no switch
, while
, do
, or for
statement in the immediately enclosing method, constructor, or initializer contains the break
statement, a compile-time error occurs.
A break
statement with label Identifier attempts to transfer control to the ...
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.