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

What is a default method?

525


What is the range of the short type?

590


How do you invoke a method?

542


Does java runtime require a license?

579


What is difference between ++ I and I ++ in java?

535






What is return code?

562


Can a private method of a superclass be declared within a subclass?

535


What is passing by reference in java?

543


What is the difference between numeric and integer?

515


What is the best way to findout the time/memory consuming process?

558


worst case complexities of Quick sort and Merge sort.

610


Can we declare an array without size in java?

524


What is space character in java?

580


Explain the Propertie sof class?

589


Is it safe to install java on my computer?

544