Multiple choice technology programming languages

What will be the output?public static void main(String[] args) { for (int i=0;i<= 10;i++){if( i>6) break;}System.out.println(i);}

  1. runtime exception

  2. 6

  3. 7

  4. comiple error.

  5. 10

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

The variable i is declared inside the for loop header, so its scope is limited to the loop body. When System.out.println(i) executes after the loop, i is out of scope, causing a compilation error. Option A is wrong because there's no runtime - compilation fails. Options B, C, and E are incorrect because the code never runs.