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. Compile Error

  5. 11

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

The variable i is declared inside the for loop header (int i=0), limiting its scope to the loop body. The System.out.println(i) statement after the loop tries to access i outside its scope, causing a compilation error. Options A, B, C, and E are incorrect because the code never compiles or runs.