Superclasses & Subclasses

Cards (5)

  • class subclassname extends superclassname{};
    With the extend keyword, the subclass inherits all methods of the superclass without duplicating code.
  • a subclass has access to all the methods of the superclass
  • Subclasses cannot inherit the superclass's constructors.
  • super(); Calls the no-argument contructor of the superclass.
    Java instantly does it in the subclass's constructor's.
  • If you call super(); With or without parameters, it must be the first line of the body of the constructor.