15 Polymorphism Explained

 

After reading lesson 15, you will be able to:

  • Understand the definition of polymorphism as it relates to Java programming
  • See the benefits of using polymorphism
  • Understand the difference between compile time and runtime polymorphism

This lesson introduces the topic of polymorphism in Java, the benefits of using polymorphism and the difference between the two types of polymorphism: compile time and runtime polymorphism. 

The term polymorphism originated as a way to refer to a biology topic where a species can have many different forms or stages. In programming, instead of referring to species, we refer to classes and how objects defined by different classes can respond to the same method differently. Here is a simple example, if you are in a room with a few other people and someone says to everyone, “move”, what would happen? Some people might sit if they were standing, people sitting might stand, some people might take a step forward.  Different people are told the same thing, but they behave differently.

15.1   Understand the Definition of Polymorphism

15.2   Benefits of Using Polymorphism

15.3   The Difference Between Compile Time and Runtime Polymorphism

15.4   Summary