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
What is a default method?
What is the range of the short type?
How do you invoke a method?
Does java runtime require a license?
What is difference between ++ I and I ++ in java?
What is return code?
Can a private method of a superclass be declared within a subclass?
What is passing by reference in java?
What is the difference between numeric and integer?
What is the best way to findout the time/memory consuming process?
worst case complexities of Quick sort and Merge sort.
Can we declare an array without size in java?
What is space character in java?
Explain the Propertie sof class?
Is it safe to install java on my computer?