What is the output of the Java code int a = new int; System.out.println(a);?
Correct answer D. 0
Explanation
Array components are always given default values when the array is created, and for int that value is 0. Java never exposes uninitialised memory. A null default would apply only to arrays of a reference type, such as String[]. The number 3 is the array length, not the content of any element.
Answer checked How we write and check questions
Discussion