Multiple choice

class MyClass { public static void main() { int s=2; for(int i=0;i<=s;i++); { System.out.print(i); } } }

  1. 01

  2. undefined loop

  3. Run time error

  4. compile time error

  5. 012

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

The scope of variable i is only for for(int i=0;i<=s;i++);  line .so that   System.out.println(i);  line   gives compile time error (cannot find symbol for variable I )