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 formatted output in java?
What is string intern in java?
What is return used for in java?
What are accessor methods in java?
What is meant by overloading?
What is an image buffer?
Explain the difference between abstract class and interface in java?
What is exception hierarchy in java?
Explain the importance of join() method in thread class?
Why is string class considered immutable?
How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?
What is arraylist e in java?
What is the difference between jdk and jre?
Is integer passed by reference in java?
Can we write method inside a method in java?