Skip to lesson

Must-do problems: Inheritance

Every problem here asks you to design a small class family: decide what belongs in the parent, what each child adds, and where super(...) and super.method() go. Keep each variable of the child type, write the classes first, and run every test before opening a hint.

What you will learn

What you will learn

  • Put shared fields and methods in a parent and only the differences in each child
  • Pass values up with super(...) and reuse parent behaviour with super.method()
  • Predict constructor order and method calls through a multilevel chain
  • Design checked and unchecked custom exceptions, alone and as a family

Sign in to continue this lesson

Create an account to read every lesson, practise with the exercises and keep track of your progress.