A

Admin • 833.24K Points
Coach

Q. What does this print?
int[] a = new int[]{1, 2};
System.out.println(a.length);

  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 0
  • Correct Answer - Option(B)
  • Views: 31
  • Filed under category Java
  • Hashtags: Java Array

Explanation by: Admin

There are 2 elements in the array, so a.length is 2.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.