Multiple choice technology architecture

What will happen if you try to compile and run the following code? public class Q { public static void main(String argv[]){ int anar[]=new int[5]; System.out.println(anar[0]); } }

  1. Error: anar is referenced before it is initialized

  2. null

  3. 0

  4. 5

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

In Java, primitive arrays are initialized with default values upon instantiation. An int array of size 5 will have all its elements automatically initialized to 0. Accessing index 0 returns 0, and the program compiles and runs successfully.