Brifly and simply explan what is Polymorphism 😧😧 ?

4/11/2019 7:05:24 AM

Kalhara indrachapa

6 Answers

New Answer


Poly=many Morph=forms Polymorphism is nothing but " one method can we use many ways" We will take one method that method have method name and parameters 1) reuse()//method without- parameters Now, we are taking same method 2) reuse(int a)//with single parameter 3) reuse(int a, int b)//with double parameters Above we used one method name "reuse" with created 3(many) different "reuse" methods is nothing but polymorphism


There are two forms of Polymorphism, static and dynamic. Static polymorphism can be achieved making use of method overloading, meaning several methods with the same name but different parameters. (Check my profile) https://code.sololearn.com/cIxdYqfW30FL/#java Dynamic polymorphism can be achieved by method overriding, so lets take example (In my profile), I have a rectangle[ShapeRectangle] which is a subclass and is assigned to the superclass called Shape [which in this case is a square]. So now if we call the overriden method[ShapeRectangle] on the super class reference [Shape], then it will return the value of the [ShapeRectangle] https://code.sololearn.com/c5o66C8ilpah/#java


Means everyone can dance: someone.dance(); But depend on their countries, cultures, they would dance differently. Mexican mexBoy = new Mexican(); mexBoy.dance(); //Mexican style Indian indiGirl = new Indian(); indiGirl.dance(); //Indian style


Polymorphism is the basic Java principle by which one method can be used for more than one purpose. Let's implement polymorphism in the Shapes class in the code below to use the method "area" to find the area of a square, a rectangle, a circle and a triangle. https://code.sololearn.com/c8oyr4Gzwd9l/?ref=app For more information, see the Sololearn tutorial on Java polymorphism.


1 function have many forms example: mobile phone


Same function/method names but with different parameters.