Multiple choice technology programming languages

What is the result when you compile and run the following code? public class Test { public void method() { for(int i = 0; i < 3; i++) { System.out.print(i); } System.out.print(i); } }

  1. 0122

  2. 0123

  3. Compilation error

  4. None of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The loop variable i is scoped to the for-loop block only. Attempting to access i outside the loop violates Java's scoping rules - local variables declared in loop initialization are not visible after the loop terminates.