A

Admin • 802.91K Points
Coach

Q. What is the output of the following code?

Code:
int[] arr = new int[]{1, 2, 3, 4, 5};
System.out.println(arr.length);
  • (A) 5
  • (B) 6
  • (C) Compiler error
  • (D) Undefined
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
The length property of an array returns the number of elements in the array.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.