Solved

Consider the Following Two Java Code Segments

Question 3

Multiple Choice

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.

Correct Answer:

verifed

Verified

Related Questions