You will learn about the Polymorphism in Java. Polymorphism means one thing many forms. Polymorphism is what allows actions to act differently based on the object performing the action. Polymorphism allows you define one interface and have multiple implementations. We can understand the concept of polymorphism with the help of following points–
Polymorphism is used in implementing the interface.
Method Overloading in Java
Method overloading in Java is a programming concept when programmer declares two methods of the same name but with different method signature e.g. change in argument list or change in a type of argument. Method overloading is one of the ways through which Java supports polymorphism.
For better understanding, Please go through with the Method Overloading Tutorial.
Selenium Testing Tutorial:
If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.
Method Overriding in Java
Overriding means having two methods with the same method name and same signature. One of the methods is in the parent class and the other is in the child class. Overriding allows a child class to provide a specific implementation of a method that is already provided its parent class.
For better understanding, Please go through with the Method Overriding Tutorial.
Polymorphism considered in two types.
- Compile time Polymorphism
- Runtime Polymorphism
Compile time polymorphism is also called StaticBbinding or method overloading because in this call to the method is resolved at compile time.
Runtime Polymorphism is also called Dynamic Binding or method overriding because in this call to the method is resolved at execution time.