Array Creation and Access

AP Computer Science A· difficulty 3/5

<code>int[] a = {1,2,3}; int[] b = a; b[0] = 99;</code> — what is a[0]?

  • A

    Throws exception

  • B

    99

    check_circle
  • C

    0

  • D

    1

Explanation

<code>b = a</code> copies reference; both point to same array.

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

Related questions