Advertisement
Advertisement
//Labelled continue example
class LabelledContinue
{
public static void main(String... ar)
{
loop:
for(int i=0;i<2;i++)
for(int j=0;j<5;j++)
{
if(j==2)
continue loop;
System.out.println("i ="+i);
System.out.println("j ="+j);
}
System.out.println("Out of the loop");
} //main method ends
} //class ends
i =0
j =0
i =0
j =1
i =1
j =0
i =1
j =1
Out of the loop
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement