A

Admin • 830.13K Points
Coach

Q. What does this code display?

Code:
int arr[] = new int [9];
System.out.print(arr);
  • (A) 00000
  • (B) 0
  • (C) value stored in arr[0]
  • (D) Garbage value
  • Correct Answer - Option(D)
  • Views: 12
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
“arr” points to an array of integers. System.out.print(arr);
will display the garbage value. This is not the same as displaying arr[0].

Garbage value designates the unused values available in memory when it is declared.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.