A

Admin • 831.35K Points
Coach

Q. What is the result of this code?
int[] arr = {10, 20, 30};
System.out.println(arr.length);

  • (A) 2
  • (B) 3
  • (C) 10
  • (D) Compile-time error
  • Correct Answer - Option(B)
  • Views: 13
  • Filed under category Java
  • Hashtags: Java Array

Explanation by: Admin
arr.length returns the number of elements in the array, which is 3.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.