public class TestClass
{
public static void main(
String args[])
{
int x = 0;
labelA: for (int i=10; i<0; i--)
{
int j = 0;
labelB:
while (j < 10)
{
if (j > i) break labelB;
if (i == j)
{
x++;
continue labelA;
}
j++;
}
x--;
}
System.out.println(x);
}
}
Options:
1)It will not compile
2)It will go infinite loop when run
3)The program will write 10 to the standard output
4)The program will write 0 to the standard output
5)None of the above..
Answer: 4)It will write 0 to the standard output.
I tried running the program and got the output 0
Can any one explain me the flow control in this case?
Sonir