Multiple choice technology programming languages

What is the output for the below code ? public class Test { static { int a = 5; } public static void main(String[] args){ System.out.println(a); } }

  1. Compile with error

  2. 5

  3. 0

  4. Runtime Exception

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

The variable 'a' is defined inside a static initialization block, making its scope local to that block. Attempting to access 'a' in the main method causes a compilation error because it is unresolved.