Polymorphism
Polymorphism means “many forms” (poly
= many, morph
= forms).
It is the ability of an object or method to take different forms and perform a single action in multiple ways.
In Java, polymorphism is categorized into two types:
Compile-time Polymorphism (also called Static Polymorphism)
Runtime Polymorphism (also called Dynamic Polymorphism)
Polymorphism in Java can be achieved through:
- Method Overloading → Used to implement compile-time polymorphism.
- Method Overriding → Used to implement runtime polymorphism.
No comments:
Post a Comment