Polymorphism

In Java, polymorphism is the capability of a method to do different things based on objects it is acting upon. Polymorphism in Java can be achieved in two ways through method overloading and method overriding. Method overloading means defining methods with the same name but with different signatures. Method overloading can be achieved in two ways: by passing different number of arguments and by passing different types of arguments. Method overriding means defining methods with the same name and same signature in both base and derived classes. To invoke the overridden method, super keyword is used in the derived class along with the overridden method of the base class. In dynamic binding, data and methods are bound by the compiler with the object during run-time. Dynamic binding is associated with polymorphism and method overriding. In static binding, data and methods are bound by the compiler with the object during compile-time. Static binding is associated with polymorphism and method overloading.

To Access the full content, Please Purchase