Tuesday, December 13, 2011

What is polymorphism in java with example?

Polymorphism: Ability to take more than one form is called polymorphism. In the following example the method area() is in two forms.In first form,it is having two arguments and second one is having single argument. So this mechanism is called polymorphism.

Example:
area(int  l,int b) 
{
}
area(int r)
{
}