OOP's Polymorphism

 It provides different services but the same name/domain.

Polymorphism is implemented by method overloading.

Example : 

class ploy{
    public static void main (String[] args){

        ploy obj = new ploy();
        obj.arae(10);
        obj.area(5,3);
    }

    void area(int a){
        System.out.println("area 1 : " + a*a);
    }

    void arae(int a, int b){
        System.out.println("area 2 " + a*b);
    }
}




Comments

Popular posts from this blog

OOP's Constructor