Question: Given the following program: public interface Flyer { public void fly ( ) ; } public class Plane implements Flyer { @Override public void fly

Given the following program:
public interface Flyer {
public void fly();
}
public class Plane implements Flyer {
@Override
public void fly(){
System.out.println("Cruising at 35,000 ft...");
}
}
public class Seagull implements Flyer {
@Override
public void fly(){
System.out.println("Soaring with the wind...");
}
}
public class Launcher {
public void launch(Flyer flyer){
System.out.println("Go fly, oh flyer!");
flyer.fly();
}
public void refuel(Plane plane){
System.out.println("Refueling the plane...");
}
}
public class FlyerApp {
public static void main(String[] args){
Launcher launcher = new Launcher();
Flyer plane = new Plane();
Flyer seagull = new Seagull();
// launcher.launch(plane); // A
// launcher.launch(seagull); // B
// launcher.refuel(plane); // C
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!