Array Creation and Access

AP Computer Science A· difficulty 4/5

To populate <code>Dog[] dogs = new Dog[3];</code>:

  • A

    Cannot create Dog array

  • B

    dogs.fill();

  • C

    for (int i = 0; i < dogs.length; i++) dogs[i] = new Dog(...);

    check_circle
  • D

    Compiler does it automatically

Explanation

Iterate and assign each slot to a new Dog.

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

Related questions