# Module 9: Polymorphism

MODULE OVERVIEW

This module introduces polymorphism in Java, an important concept in
object-oriented programming that allows methods to perform different behaviours
depending on how they are used or the object involved.



Learners will explore method overloading and method overriding, understand the
differences between compile-time and runtime polymorphism, and learn how dynamic
method dispatch works.



These concepts help developers create flexible, reusable and maintainable
applications by allowing different objects to respond to the same method call in
different ways.






WHAT WILL BE COVERED


9.1 WHAT IS POLYMORPHISM?

 * Understanding the concept of polymorphism in Java.

 * Exploring how one method or interface can represent different behaviours.

 * Understanding the role of polymorphism in object-oriented programming.

 * Exploring the relationship between inheritance and polymorphism.

 * Understanding how polymorphism supports code flexibility and reusability.

 * Identifying practical applications of polymorphism in Java programs.


9.2 METHOD OVERLOADING

 * Understanding the concept of method overloading.

 * Defining multiple methods with the same name in a class.

 * Working with different parameter lists.

 * Understanding method overloading based on the number, type and order of
   parameters.

 * Exploring how Java identifies the appropriate method.

 * Applying method overloading to perform similar operations with different
   inputs.


9.3 METHOD OVERRIDING

 * Understanding the purpose of method overriding.

 * Redefining a parent class method in a child class.

 * Exploring method overriding through inheritance.

 * Understanding the rules for overriding methods.

 * Using the @Override annotation.

 * Applying method overriding to customise inherited behaviour.


9.4 COMPILE-TIME POLYMORPHISM

 * Understanding compile-time polymorphism.

 * Exploring how method calls are resolved during compilation.

 * Understanding the role of method overloading.

 * Working with methods that accept different parameter combinations.

 * Identifying how the compiler selects the appropriate method.

 * Applying compile-time polymorphism to develop flexible methods.


9.5 RUNTIME POLYMORPHISM

 * Understanding runtime polymorphism in Java.

 * Exploring how overridden methods are executed at runtime.

 * Working with parent class references and child class objects.

 * Understanding method selection based on the actual object.

 * Exploring runtime method resolution.

 * Applying runtime polymorphism to develop flexible application components.


9.6 DYNAMIC METHOD DISPATCH

 * Understanding the concept of dynamic method dispatch.

 * Exploring how Java determines which overridden method to execute.

 * Working with superclass references pointing to subclass objects.

 * Understanding runtime method selection.

 * Exploring the relationship between dynamic method dispatch and runtime
   polymorphism.

 * Applying dynamic method dispatch in inheritance-based applications.


SKILLS YOU WILL GAIN

 * Understanding polymorphism in Java.

 * Implementing method overloading.

 * Applying method overriding through inheritance.

 * Distinguishing between compile-time and runtime polymorphism.

 * Working with parent class references and child class objects.

 * Understanding dynamic method dispatch.

 * Developing flexible methods for different application requirements.

 * Applying polymorphism to improve code reuse and maintainability.


LEARNING OUTCOMES

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

 * Apply polymorphism to develop flexible application components that support
   different business operations.

 * Create overloaded methods to process different types of input using a common
   method name.

 * Override inherited methods to customise behaviour for different business
   entities.

 * Use compile-time polymorphism to organise methods that perform similar
   operations with different inputs.

 * Apply runtime polymorphism to support different object behaviours within a
   common application structure.

 * Use dynamic method dispatch to execute appropriate methods based on the
   actual object at runtime.

 * Design reusable Java components that can accommodate changing application
   requirements.

 * Improve application maintainability by reducing the need for repetitive and
   duplicated code.


CERTIFICATION ALIGNMENT

This module develops Java polymorphism 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 method overloading, method
overriding, runtime behaviour and dynamic method dispatch within Java
applications.


CONTINUE TO THE NEXT MODULE

Continue to Module 10: Encapsulation and Abstraction to learn how Java protects
data, controls access to class members and simplifies application design using
encapsulation, abstract classes and interfaces.