Skip to Content
Java Program Design: Principles, Polymorphism, and Patterns
book

Java Program Design: Principles, Polymorphism, and Patterns

by Edward Sciore
December 2018
Intermediate to advanced
465 pages
8h 5m
English
Apress
Content preview from Java Program Design: Principles, Polymorphism, and Patterns
© Edward Sciore 2019
Edward ScioreJava Program Designhttps://doi.org/10.1007/978-1-4842-4143-1_3

3. Class Hierarchies

Edward Sciore1 
(1)
Newton, MA, USA
 

Chapter 2 examined how interfaces can extend other interfaces, creating a hierarchy of types. One of the characteristics of an object-oriented language is that classes can extend other classes, creating a class hierarchy. This chapter investigates class hierarchies and the ways they can be used effectively.

Subclasses

Java allows one class to extend another. If class A extends class B, then A is said to be a subclass of B and B is a superclass of A. Subclass A inherits all public variables and methods of its superclass B, as well as all of B’s code for these methods.

The most common example of subclassing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Design Patterns and SOLID Principles with Java

Design Patterns and SOLID Principles with Java

Róbert Kohányi
Design Patterns and Best Practices in Java

Design Patterns and Best Practices in Java

Kamalmeet Singh, Ianculescu, Lucian-Paul Torje

Publisher Resources

ISBN: 9781484241431Purchase LinkPublisher Website