Consider the following two Java code segments:
Segment 1 Segment 2
int i = 0;
for (int i = 0; i <= 20; i++)
while (i < 20) {
{ System.out.println(i);
i++; }
System.out.println(i);
}
Which of the following statements are true?
a. The output from these segments is not the same.
b. The scope of the control variable i is different for the two segments.
c. Both (a) and (b) are true.
d. Neither (a) nor (b) is true.
c. Both (a) and (b) are true.
Computer Science & Information Technology
You might also like to view...
Which of the following is most susceptible to ESD?
A) Flash memory B) Thumb drive C) BIOS D) RAM
Computer Science & Information Technology
A subclass often has methods that do not appear in its superclass.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology