© Vaskaran Sarcar 2020
V. SarcarInteractive Object-Oriented Programming in Javahttps://doi.org/10.1007/978-1-4842-5404-2_5

5. Get Familiar with Polymorphism

Vaskaran Sarcar1 
Bangalore, Karnataka, India

Let’s review what you have already learned about polymorphism. Polymorphism is generally associated with one name with many forms; for example, if you have two integer operands with the addition operation, you expect to get a sum of the integers, but if the operands are two strings, you expect to get a concatenated string. I also mentioned that polymorphism can be of two types: compile-time polymorphism and runtime polymorphism.

Here, I’ll start our discussion with compile-time polymorphism.

In compile-time polymorphism, the compiler can bind the ...

Get Interactive Object-Oriented Programming in Java: Learn and Test Your Programming Skills now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.