D

Deepak Sahoo • 10.78K Points
Tutor II

Q. What is the output of the following code?

Code:
int[] arr = new int[5];
System.out.println(arr[0]);
  • (A) 0
  • (B) null
  • (C) Compiler error
  • (D) Undefined
  • Correct Answer - Option(A)
  • Views: 101
  • Filed under category JAVA

Explanation by: Deepak Sahoo
The default value of an int array is 0.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics