© Kishori Sharan 2017

Kishori Sharan, Beginning Java 9 Fundamentals, https://doi.org/10.1007/978-1-4842-2902-6_20

20. Inheritance

Kishori Sharan

(1)Montgomery, Alabama, USA

In this chapter, you will learn:

  • What inheritance is

  • How to inherit a class from another class

  • The difference between early binding and late binding

  • What method overriding is and how to override methods

  • What field hiding and method hiding are and how to use them

  • What abstract classes are and where to use them

  • How to declare final classes and methods

  • The difference between “is-a,” “has-a,” and “part-of” relationships

All example programs in this chapter are a member of a jdojo.inheritance module, as declared in Listing 20-1.

Listing 20-1. The Declaration of a jdojo.inheritance Module

Get Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions 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.