Answers for "using which of the following, multiple inheritance in java can be implemented?"

1

multiple inheritance using interface in java

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 Demo {
   public static void main(String args[]) {
      Animal a = new Animal();
      a.eat();
      a.travel();
   }
}
Posted by: Guest on March-24-2022

Code answers related to "using which of the following, multiple inheritance in java can be implemented?"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language