Need of Polymorphism

What is need of polymorphism in Java? What could have happen if polymorphism is not present?

Questions by shanky_06   answers by shanky_06

Editorial / Best Answer

syamala235  

  • Member Since Mar-2010 | Apr 8th, 2010


Polymorphism in simple terms means one name many forms. Polymorphism enables one entity to be used as a general category for different types of actions. The specific action is determined by the exact nature of the situation.

Polymorphism exists in three distinct forms in Java:
• Method overloading
• Method overriding through inheritance
• Method overriding through the Java interface

Showing Answers 1 - 24 of 24 Answers

vivesh5935

  • Jan 11th, 2010
 

Polymorphism enables you to define one or more methods to have the same name but difffering in number of parameters and method types.
If we do not have polymorphism in Java then we cannot overload methods.

syamala235

  • Apr 8th, 2010
 

Polymorphism in simple terms means one name many forms. Polymorphism enables one entity to be used as a general category for different types of actions. The specific action is determined by the exact nature of the situation.

Polymorphism exists in three distinct forms in Java:
• Method overloading
• Method overriding through inheritance
• Method overriding through the Java interface

Rupesh Raghani

  • May 31st, 2012
 

The basic reason behind polymorphism is that we can implement different behaviors of the same object depending upon the reference type passed to an object.
In case of static polymorphism(Method OverLoading) we can give a different flavors of the same method which gives a flexibility of different inputs. You can have an example of value of method of java.lang.String class, which takes any data type as an input, so in this way we can use same method for variety of inputs, which reduces naming conflicts and makes code more maintainable.

  Was this answer useful?  Yes

avinash

  • Sep 26th, 2012
 

jdbc,servlets,jsp have come through polymorphism,if not there we have to remember all dependent classes related to DB,Servers...to use in our java coding

  Was this answer useful?  Yes

Ajas Mohammed

  • Jan 13th, 2016
 

This is method overloading. Polymorphism enables method overriding not overloading. Method overriding means use of same method with same name, parameters and return type.

  Was this answer useful?  Yes

suraj

  • Jun 19th, 2017
 

Polymorphism means one thing in many form. or one person different behavior is called polymorphism.

  Was this answer useful?  Yes

Prashant kumar gupta

  • Oct 28th, 2017
 

We have different behaviors in different situations and in front of different people. A man behaves differently with his father, when he is with his friend he has different behavior.
Another best example is println(). it is prints different data type value.

Hence Polymorphism means single name and many forms.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions