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


Please Help Members By Posting Answers For Below Questions

How does arraylist size increase in java?

757


What does super keyword do?

764


What is meant by 'bit masking' in java?

857


Explain constructors and types of constructors in java.

827


What is the biggest integer?

796


Can there be an abstract method without an abstract class?

716


Can a function return a function?

760


Is array a class?

699


Is .net better than java?

759


What is a cup of java?

774


What is the exact difference in between Unicast and Multicast object?

1748


Explain about exception propagation?

751


What is the difference amongst jvm spec, jvm implementation, jvm runtime ?

707


What is the basic concepts of OOPS?

905


Which method returns the length of a string?

769