what is polymorphism with example?types of polymorphism?
Answer Posted / ramaraju
polymorphism means "same thing will exists with different
forms"
Ex :suppose we need to find volume of
circle,rectangle,triangle.ect in a sampe program.
genrally what we need to do is write the code volume for
cirle,rectangle,triangle in sepratly.
using polymorphism concept we simply write the volume code
with different parameter list ect
Ex:
class a {
volume(int a)//for rectangle
{
---
}
volume (int a,intb,intc)//for triangle
{
--
}
volume (string s)//for circle
{
--
}
}end of class A
polymorphisam are mainly two types
static polymorphisam(corresponding method will bind at the
time of compiling)
dynamic polymorphisam(corresponding method will bind at the
run time)
| Is This Answer Correct ? | 162 Yes | 18 No |
Post New Answer View All Answers
Where import statement is used in a java program?
How can you traverse a linked list in java?
What is java util concurrentmodificationexception?
What is defined as false sharing in the context of multithreading?
How to convert string to byte array and vice versa?
What are class members by default?
How many bytes is a string java?
What is t in parametric equations?
I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?
Does windows 10 need java?
What is the difference between object oriented programming language and object based programming language?
What is string [] java?
What are decalarations?
What is balanced tree in java?
Can you sort a list in java?