9 Object-Oriented Programming: Inheritance

Objectives

In this chapter you’ll:

  • Understand inheritance and how to use it to develop new classes based on existing classes.

  • Learn the notions of superclasses and subclasses and the relationship between them.

  • Use keyword extends to create a class that inherits attributes and behaviors from another class.

  • Use access modifier protected in a superclass to give subclass methods access to these superclass members.

  • Access superclass members with super from a subclass.

  • Learn how constructors are used in inheritance hierarchies.

  • Learn about the methods of class Object, the direct or indirect superclass of all classes.

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.