Nov 12
  • The break and continue statement can be followed by a label.
  • The presence of a label will transfer control to the start of the code identified by the label.
  • The label name can be anything that follows java naming rules.

General use of labelled break is as follows :

outer :

while (<condition>)

{

<statement 1>;

while(<condition>)

{

<statement2>;

if(<condition>)

{

breakĀ  outer;

}

}

<statement 3>;

}

General use of labelled continue is as follows :

test:

while (<condition>)

{

<statement 1>;

while(<condition>)

{

<statement2>;

if(<condition>)

{

breakĀ  test;

}

}

<statement 3>;

}

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • Twitter

written by Anup