The word Polymorphism means having many forms. In object-oriented programming languages, Polymorphism provides the means to perform a single action in multiple different ways.
Let’s look at an example, if you ask different animals to speak, they respond in their own way. Dog will bark, duck will quack, cat will say meow and so on. So here you see, same action of speaking is performed in different ways by different animals. This is the concept of Polymorphism.
In Java Polymorphism is supported through 2 concepts — Method Overloading and Method Overriding. In both of these concepts, there is a function which shows different behaviours depending on its arguments or the object in the class hierarchy which is implementing it. Essentially like our animal speak example, in programming you can have the same method performing different things when called through different objects. Polymorphism together with Inheritance enables us to model complex real-world systems in a scalable and maintainable way in software.
All these concepts will become more concrete when we will start implementing them in programs in the Java section of this course.