The word “Polymorphism” means “many forms”. It comes from
the Greek word “Poly” which means “many” and “morphous” means “forms”. The
ability to exist in different form is called Polymorphism.
In java ,
a variable, an object or a method can exist in
different forms, thus performing various tasks depending on the context. If the
same method performs different tasks, then that method is said to exhibit
There are two types of Polymorphism:
1. Static polymorphism —-
The polymorphism exhibited at compile
time is called static polymorphism.
2. Dynamic polymorphism-—
exhibited at run time is called dynamic polymorphism.
This means when a method is called, the method
call is bound to the method body at the time of running the program,
In this case, java compiler does not know
which method is called at the time of compilation, only JVM knows at
runtime which method is to be executed.
Hence this is also called runtime
polymorphism or dynamic binding.