Array Creation and Access

AP Computer Science A· difficulty 3/5

Accessing <code>a[5]</code> on a length-3 array

  • A

    Returns null

  • B

    Throws ArrayIndexOutOfBoundsException at runtime

    check_circle
  • C

    Returns 0

  • D

    Compile error

Explanation

Bounds checked at runtime; throws AIOOBE.

Want 10 more like this — adaptive to your weak spots?

Related questions