Java Polymorphism tutorial with example


Java Polymorphism

Polymorphism literally means taking more than one form .polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class.

There are two types of polymorphism

Overloading
The Java programming language supports overloading methods, and Java can distinguish between methods with different method signatures
Overloading is also known as Compile time polymorphism

Overloading comes in two favor.

1. Method overloading   Read More ...
2. Constructor overloading Read More ...

Overriding
An instance method in a subclass with the same signature (name, plus the number and the type of its parameters) and return type as an instance method in the superclass overrides the superclass's method.
Read More ...



Comments


©candidjava.com