In this tutorial, we will learn about Java Polymorphism. Polymorphism is the ability of an object to take on many forms.
Polymorphism is one of the basic principles of Object-Oriented Programming. There are two types of polymorphism:
- Static Polymorphism
- Dynamic Polymorphism
Polymorphism is the capability of an action or method to do different things based on the object.
Method overloading is defining more than one method with the same name but with different method signatures. The name of the method is the same but the number and type of method parameters and method return types might be different. When an overloaded method is encountered, Java executes the version of the method whose parameters match the arguments used in the method call.
Method overriding allows programmers to provide different implementations for the methods in parent class and subclasses. The method name and the method signature would be the same but with different implementations. The actual method called depends on the type of object at runtime.
Java Tutorial on this website:
For more information on Java, visit the official website :