A

Admin • 825.56K Points
Coach

Q. What is the result of this code?
int[] arr = new int[]{1, 2, 3};
System.out.println(arr[3]);

  • (A) 3
  • (B) 0
  • (C) ArrayIndexOutOfBoundsException
  • (D) null
  • Correct Answer - Option(C)
  • Views: 10
  • Filed under category Java
  • Hashtags: Java Array

Explanation by: Admin
Index 3 is out of bounds for an array of size 3. It throws an exception.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.