Polymorphism in Java – OOP – Code Example

In previous posts we have discussed many important topics of object oriented programming like classes, objects, inheritance etc. In this post we will discuss polymorphism in Java which is another important OOP concept. What is Polymorphism in Java? The word polymorphism means 'a state of having many shapes'. In terms of object oriented programming it's the ability to process objects of various types and classes through a single uniform interface. An object, variable or function may take on multiple forms / shapes and this phenomenon is known as Polymorphism. Example of Polymorphism in JAVA: [js] public int add(int a, int b){...
forward