Chapter 9. Object-Oriented Programming: Inheritance

Say not you know another entirely, till you have divided an inheritance with him.

Johann Kasper Lavater

This method is to define as the number of a class the class of all classes similar to the given class.

Bertrand Russell

Objectives

In this chapter you’ll learn:

• How inheritance promotes software reusability.

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

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

• To use access modifier protected to give subclass methods access to superclass members.

• To access superclass members with super.

• How constructors are used in inheritance hierarchies.

• The methods ...

Get Java™ for Programmers: Deitel Developer Series, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.