Multiple choice technology programming languages

What will be the result of compiling following code public class SampleClass { final int j ; public static void main(String[] arguments) { System.out.println(new SampleClass().j); } }

  1. The output is 0

  2. Will give compile error

  3. Will give runtime error

  4. The output is 1

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

The final instance variable j is not initialized at declaration, in an instance initializer block, or within any constructor. In Java, all uninitialized final instance variables cause a compile-time error. This prevents the code from compiling, making options claiming successful execution or runtime errors incorrect.