O'Reilly logo

Java: A Beginner’s Tutorial, 4th Edition (Updated for Java SE 8) by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7

Inheritance

Inheritance is a very important object-oriented programming (OOP) feature. It is what makes code extensible in an OOP language. Extending a class is also called inheriting or subclassing. In Java, by default all classes are extendible, but you can use the final keyword to prevent classes from being subclassed. This chapter explains inheritance in Java.

Overview

You extend a class by creating a new class. The former and the latter will then have a parent-child relationship. The original class is the parent class or the base class or the superclass. The new class is the child class or the subclass or the derived class of the parent. The process of extending a class in OOP is called inheritance. In a subclass you can add new ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required