Sunday, 18 December 2022

Write a program To display method print the addition and substraction by using abstraction.

 


CODE:

abstract class Math {
    abstract void display();
   
}

class add extends  Math {
    public void display() {
        int a=3,b=3;
        System.out.println(a+b);
    }
}

class sub extends Math {

    public void display() {
        int e=3,f=3;
        System.out.println(e-f);
    }

}




No comments:

Post a Comment

GitHub Most Imp Command For Every Developer Learn:

 Top Command for GitHub:  1) git clone 2) git init and git status   3) git add file name  or git add .  4) git commit -m message  5) git rem...