JAVA Polymorphism

Polymorphism is a process in which the behaviour of an object is used by another of an object is used by another object in it work by updating or modifying it, it is often achieved by method overriding and method overloading.

Polymorphism it is made up of two words “poly” and “morph” which mean that an object has many states.

For ex:

class Student(){
    private String name;
    private int age;
    public void printInfo(String name){
        System.out.println(name);
    }
    public void printInfo(String age){
        System.out.println(age);
    }
    public void printInfo(String name, String age){
        System.out.println(name +""+ age);
    }
    }
    public class main{
    public static void Main(String[]args){
        student s1=new student();
        s1.name="Learner";
        s1.age="20";
        s.printInfo(S1.name,s1.age);
        
    }
}