Computer Science, asked by nithishvisva, 16 days ago

Create two interfaces called as Flying and Living interfaces and implement multiple
inheritance on the class “Bird”
a. The Flying interface should have methods like speed() and getMaxFlyHeight().
The Living interface should have methods like getName(), getWeight() and
getHeight().
b. Create two different objects of the class Bird (Bird should implement multiple
inheritance)

Answers

Answered by YaoiGod1
1

@Override

public void fly() {

System.out.println("Plane flying in the sky" );

}

}

public class Bird implements IFly {

@Override

public void fly() {

System.out.println("The bird soars in the sky" );

}

}

public class Balloon implements IFly {

@Override

public void fly() {

System.out.println("Balloons fly to the sky" );

}

}

test

public class Test {

public static void main(String[] args) {

IFly plane = new Plane();

IFly bird = new Bird();

IFly balloon = new Balloon();

plane.fly();

bird.fly();

balloon.fly();

}

}

Answered by sabarish13052011
0

Answer:

@Override

public void fly() {

System.out.println("Plane flying in the sky" );

}

}

public class Bird implements IFly {

@Override

public void fly() {

System.out.println("The bird soars in the sky" );

}

}

public class Balloon implements IFly {

@Override

public void fly() {

System.out.println("Balloons fly to the sky" );

}

}

test

public class Test {

public static void main(String[] args) {

IFly plane = new Plane();

IFly bird = new Bird();

IFly balloon = new Balloon();

plane.fly();

bird.fly();

balloon.fly();

}

}

Explanation:

Similar questions