Answer Posted / devesh dashora
break with label and continue with label.
1. Break with label
loop1: for (int i = 0; i < 10; i++)
{
loop2: for ( int j = 0; j < 10; j++)
{
System.out.println(i);
if( i + j > 10 )
break loop1;
}
}
2. continue with label
loop1: for (int i = 0; i < 10; i++)
{
loop2: for ( int j = 0; j < 10; j++)
{
if(i + j == 5)
continue loop1;
System.out.println(j);
}
}
| Is This Answer Correct ? | 12 Yes | 20 No |
Post New Answer View All Answers
What is the access scope of protected access specifier?
What is Hierarchy of exception?
Explain inner classes ?
Is main an identifier?
What is static data type in java?
Explain the concept of proper inheritance?
What do you mean by aggregation?
Why we use protected in java?
What are the different types of constructor?
What is a function in programming?
What is the difference between stringbuffer and stringbuilder class?
Difference between static synchronization vs. Instance synchronization?
When should I use singleton pattern?
What do you mean by buffering?
What methodology can be employed to locate substrings inside a string?