1.
for (int i = 1; i <= 5; ++i)
{
if (i > 5)
{
continue;
}
System.out.println(i);
}
The output for the above code fragment is
1
2
3
4
5
when the value of i is greater than 5, the control will go to the next iteration, so from 6 to 10 will not be printed.
2.
for (int i = 1; i <= 5; ++i)
{
if (i > 5)
{
continue;
}
System.out.println(i);
}
The output for the above code fragment is
1
2
3
4
5
when the value of i is greater than 5, the control will go to the next iteration, so from 6 to 10 will not be printed.
2.
for (int i = 1; i <= 10; ++i)
{
if (i > 4
&& i < 9)
{
continue;
}
System.out.println(i);
}
The output will be
1
2
3
4
9
10
No comments:
Post a Comment