Inheritance I

  1. Contents
  2. What is Inheritance?
  3. The “is a” Relationship
  4. Inheritance, Fields, and Methods
  5. Inheritance and Constructors
  6. Overriding Superclass Methods
  7. Preventing a Method from Being Overridden
  8. Protected Members
  9. Default Members
  10. Access Specifiers
  11. Chain of Inheritance

What is Inheritance?

The “is a” Relationship

Inheritance, Fields, and Methods

Inheritance and Constructors

Overriding Superclass Methods

Preventing a Method from Being Overridden

Protected Members

Default Members

Access Specifiers

Access ModifierAccessible to a subclass in side the same package?Accessible to all other classes inside the same package?Accessible to a subclass outside the package?Accesible to all other classes outside the package?
publicYesYesYesYes
protectedYesYesYesNo
default
(no modifier)
YesYesNoNo
privateNoNoNoNo

Chain of Inheritance