A

Admin • 833.24K Points
Coach

Q. What will happen if you try to access arr[-1]?

  • (A) Returns first element
  • (B) Returns last element
  • (C) Throws ArrayIndexOutOfBoundsException
  • (D) Returns null
  • Correct Answer - Option(C)
  • Views: 25
  • Filed under category Java
  • Hashtags: Java Array

Explanation by: Admin

Negative indices are invalid and throw ArrayIndexOutOfBoundsException.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.