Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

Pgm 10 || Write a program to demonstrate multiple inheritance and use of implementing Interfaces.

 interface AnimalEat {

void eat();

}

interface AnimalTravel {

void travel();

}

class Animal implements AnimalEat, AnimalTravel {

public void eat() {

System.out.println("Animal is eating");

}

public void travel() {

System.out.println("Animal is travelling");

}

}

public class Pgm10 {

public static void main(String args[]) {

Animal a = new Animal();

a.eat();

a.travel();

}

}

Post a Comment

0 Comments