in JAVA by
Q:
What is Polymorphism?

Polymorphism means many forms.

A single object can refer the super class or sub-class depending on the reference type which is called polymorphism.

Example:

1

Public class Manipulation(){ //Super class

2

public void add(){

3

}

4

}

5

public class Addition extends Manipulation(){ // Sub class

6

public void add(){

7

}

8

public static void main(String args[]){

9

Manipulation addition = new Addition();//Manipulation is reference type and Addition is reference type

10

addition.add();

11

}

12

}

Using Manipulation reference type we can call the Addition class “add()” method. This ability is known as Polymorphism.

Polymorphism is applicable for overriding and not for overloading.

Related questions

0 votes
asked May 24, 2019 in JAVA by rajeshsharma
0 votes
asked May 24, 2019 in JAVA by rajeshsharma
...