Array Creation and Access

AP Computer Science A· difficulty 4/5

<code>Dog[] dogs = new Dog[3];</code> creates

  • A

    Array of empty Dogs

  • B

    Compile error

  • C

    Array of 3 null references

    check_circle
  • D

    3 Dog objects

Explanation

Reference array elements default to <code>null</code>; you must explicitly create each Dog.

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

Related questions