Header Ads

Header ADS

example:1:abstrac claaa

 abstract class Honda {

   
    public abstract void Hondacar();

    public void model() {
        System.out.println("bolaro");
    }
}

//sub class inherit from honda
class Car extends Honda {
    public void Hondacar() {
        System.out.println("Honda say:my car is best");
    }
}

class firstprogramm {
    public static void main(String[] args) {
        Car myCar = new Car(); // Create a car object
        myCar.Hondacar();
        myCar.model();
    }
}


No comments

Powered by Blogger.