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
How many bytes is double?
What is the difference between array and array list in java?
How do you invoke a method?
what is bmg file and how to create that files?what will it contailn?
How to set the permissions to a file in java?
What is the benefit of using enum to declare a constant?
How do you take thread dump in java?
How do you reverse sort in java?
Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.
Why are the objects immutable in java?
Why set is used in java?
Explain how can you debug the Java code?
What are synchronized methods ?
How do you decide when to use arraylist and linkedlist?
What is static synchronization?