Anatomy of a Class

AP Computer Science A· difficulty 3/5

<code>Dog a = new Dog(); Dog b = new Dog();</code> — a and b are

  • A

    Compile error

  • B

    References to null

  • C

    Two distinct objects with their own state

    check_circle
  • D

    The same object

Explanation

Each <code>new</code> creates a fresh object.

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

Related questions