Write a Java program to demonstrate an abstract class extending another abstract class
abstract class Animal { abstract void makeSound(); } abstract class Mammal extends Animal { abstract void move(); } class Dog extends Mammal { @Override void makeSound() { System.out.println("Dog barks"); } @Override void move() { System.out.println("Dog runs"); } } public class Main { public static void main(String[] args) { Dog dog = new Dog(); dog.makeSound(); dog.move(); } }
Dog barks Dog runs
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions