Site icon TestingDocs.com

Java Polymorphism

Overview

In this tutorial, we will learn about Java Polymorphism. Polymorphism is the ability of an object to take on many forms.

Java Polymorphism

Polymorphism is one of the basic principles of Object-Oriented Programming. There are two types of polymorphism:

 

Polymorphism is the capability of an action or method to do different things based on the object.

Method Overloading

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

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 Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version