Writing Constructors for Subclasses

AP Computer Science A· difficulty 4/5

If parent has only <code>Animal(String name)</code> (no no-arg), the subclass

  • A

    Will compile fine without

  • B

    Must call super(name) explicitly

    check_circle
  • C

    Will throw exception at runtime

  • D

    Cannot extend

Explanation

Without no-arg parent constructor, subclass must call super(args) explicitly.

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

Related questions