A

Admin • 828.43K Points
Coach

Q. What will be the output?
int[] arr = {1, 2, 3};
System.out.print(arr[1]);

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

Explanation by: Admin
arr[1] accesses the second element, which is 2.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.