JAVA Programming :: Basic Concepts - Discussion
14 / 64
for(int i=0;i<5;) {
System.out.println(i);
i++;
continue;
}
for(int i=0;i<5;) {
System.out.println(i);
i++;
continue;
}
ACompile time error
BRuntime error
CCompile and run with output 0 to 4
DNone of the above
Show Explanation
Value of 'i' Test condition(i<5) Output i++
0 True 0 i=0+1=1
1 True 1 i=1+1=2
2 True 2 i=2+1=3
3 True 3 i=3+1=4
4 True 4 i=4+1=5
5 False - -
Asked In ::
Actually the answer is A.
Continue satatement come under only loops.
for (;;).
for (:).
while ().
do while () ;.
Other than it gives compilation error and if you use break than you can use two other places.
block.
switch.
Read Full Answer
Report Error
Please Login First Click Here
We can dry run the code as-
Value of 'i' Test condition(i<5) Output i++
0 True 0 i=0+1=1
1 True 1 i=1+1=2
2 True 2 i=2+1=3
3 True 3 i=3+1=4
4 True 4 i=4+1=5
5 False - -
Read Full Answer
Report Error
Please Login First Click Here