What is meant by polymorphism ?

What is meant by polymorphism ?

Polymorphism is a useful mechanism in java. Polymorphism means \'one name with multiple implementaions.\'

Java supports two types of polymorphism: static and dynamic polymorphism.

 Polymorphism can be achieved in java by method overloading (static polymorphism) and method overriding (dyanmic polymorphism). 

 Overloading: Using the same method name with multiple implementation in such a way that the argument list must be changed and return type may change. For overloading, change in the argument list is a must. Overloading resolve at the time of compilation.

 Overriding: Using the same method name with thesame argument list and return type called method overriding. However in Java 5, the ruturn type ofthe overrriding method may be changed with the subtype of the overridden method.


By:Jalees
Date:2012-01-09 00:00:00

Polymorphism is a useful mechanism in java. Polymorphism means \'one name with multiple implementaions.\'

Java supports two types of polymorphism: static and dynamic polymorphism.

 Polymorphism can be achieved in java by method overloading (static polymorphism) and method overriding (dyanmic polymorphism). 

 Overloading: Using the same method name with multiple implementation in such a way that the argument list must be changed and return type may change. For overloading, change in the argument list is a must. Overloading resolve at the time of compilation.

 Overriding: Using the same method name with thesame argument list and return type called method overriding. However in Java 5, the ruturn type ofthe overrriding method may be changed with the subtype of the overridden method.


By:Sumit Tripathi
Date:2018-05-15 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher