Module 8: Inheritance

Markdown

View as Markdown

Module Overview

This module introduces inheritance in Java, one of the fundamental concepts of object-oriented programming.

Learners will understand how one class can inherit properties and methods from another class, allowing code to be reused and organised more effectively.

The module covers different types of inheritance, including single, multilevel and hierarchical inheritance. It also explores hybrid inheritance using interfaces, the super keyword and method overriding.

These concepts help learners develop structured Java applications, reduce code duplication and create relationships between classes.

What Will Be Covered

8.1 What is Inheritance?

  • Understanding the concept of inheritance in Java.

  • Exploring the relationship between parent and child classes.

  • Understanding how one class inherits properties and methods from another.

  • Learning the benefits of code reusability.

  • Understanding the role of the extends keyword.

  • Exploring how inheritance supports object-oriented application development.

8.2 Single Inheritance

  • Understanding the concept of single inheritance.

  • Creating a child class that inherits from one parent class.

  • Using the extends keyword to establish inheritance.

  • Accessing inherited properties and methods.

  • Exploring practical examples of single inheritance.

  • Applying single inheritance to organise related classes.

8.3 Multilevel Inheritance

  • Understanding the structure of multilevel inheritance.

  • Creating inheritance relationships across multiple levels.

  • Exploring parent, intermediate and child classes.

  • Accessing inherited members across the inheritance hierarchy.

  • Understanding how properties and methods are passed through multiple levels.

  • Applying multilevel inheritance to structured application designs.

8.4 Hierarchical Inheritance

  • Understanding the concept of hierarchical inheritance.

  • Creating multiple child classes from a common parent class.

  • Sharing common properties and methods across related classes.

  • Accessing inherited members in different child classes.

  • Exploring practical examples of hierarchical class structures.

  • Applying hierarchical inheritance to reduce code duplication.

8.5 Hybrid Inheritance Using Interfaces

  • Understanding the concept of hybrid inheritance.

  • Exploring how Java uses interfaces to support multiple inheritance of type.

  • Implementing interfaces in Java classes.

  • Using multiple interfaces within a class.

  • Combining class inheritance with interface implementation.

  • Understanding how interfaces help achieve flexible and reusable application structures.

8.6 super Keyword

  • Understanding the purpose of the super keyword.

  • Accessing parent class variables using super.

  • Calling parent class methods using super.

  • Invoking parent class constructors.

  • Understanding the relationship between parent and child class members.

  • Applying the super keyword when working with inherited classes.

8.7 Method Overriding

  • Understanding the concept of method overriding.

  • Redefining an inherited method in a child class.

  • Understanding the rules for method overriding.

  • Exploring the use of the @Override annotation.

  • Understanding how overridden methods are executed.

  • Applying method overriding to customise inherited behaviour.

Skills You Will Gain

  • Understanding inheritance in Java.

  • Creating parent and child class relationships.

  • Implementing single, multilevel and hierarchical inheritance.

  • Using interfaces to support hybrid inheritance structures.

  • Accessing parent class members using the super keyword.

  • Overriding inherited methods.

  • Reusing properties and methods across related classes.

  • Designing organised and reusable object-oriented programs.

Learning Outcomes

By the end of this module, learners will be able to:

  • Design class relationships to represent business entities with shared properties and behaviours.

  • Apply inheritance to reduce code duplication when developing employee, customer, product and account management applications.

  • Implement single, multilevel and hierarchical inheritance based on application requirements.

  • Use interfaces to create flexible class structures and support multiple inheritance of type.

  • Access parent class variables, methods and constructors using the super keyword.

  • Override inherited methods to customise application behaviour for different business requirements.

  • Organise Java applications using reusable class structures.

  • Apply inheritance concepts to develop maintainable and scalable object-oriented applications.

Certification Alignment

This module develops Java inheritance and object-oriented programming knowledge that supports the broader learning pathway towards the Oracle Certified Professional: Java SE 17 Developer certification.

The topics covered help learners understand class relationships, inheritance structures, interfaces and method overriding within Java applications.

Continue to the Next Module

Continue to Module 9: Polymorphism to learn how Java supports different forms of method behaviour through method overloading, method overriding, compile-time polymorphism, runtime polymorphism and dynamic method dispatch.

Was this article helpful?

Still need help?

Contact us