
write the output if the following code is executed.
class LabeledLoop
{
public static void main(String arg[]) {
mgr:
for(int i=1; i<=3; i++)
for(int i=1; j<=3; j++) {
System.out.println("i is "+ i +",j is "+ j);
if ((i+j)>2)
break mgr;
}
System.out.println("End of loops");
}}

There is an error in your code but we have solved it.
Here is your code:
class FindOutput
{
public static void main(String arg[]) {
mgr:
for(int i=1; i<=3; i++)
for(int j=1; j<=3; j++) {
System.out.println("i is "+ i +",j is "+ j);
if ((i+j)>2)
break mgr;
}
System.out.println("End of loops");
}}
It returns output:
i is 1, j is 1 i is 1, j is 2 End of loops
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.