Advertisements
Advertisements
Question
Predict the output:
int i, j;
first:
for (i = 1; i < 10; i = i + 2)
{
for (j = 3; j >= 1; j = j - 2)
{
if (i > 5)
break first;
System.out.println("i=" + i + ",j=" + j);
}
}
Answer in Brief
Solution
i = 1, j = 3
i = 1, j = 1
i = 3, j = 3
i = 3, j = 1
i = 5, j = 3
i = 5, j = 1
shaalaa.com
Is there an error in this question or solution?