面向对象多态性
abstract class TakeOffSystem { public abstract void fly(); public abstract void land(); } class BattlePlan extends TakeOffSystem{ public void fly(){ System.out.println("战斗机起飞了"); } public void land(){ System.out.println("战斗机降落了"); } } class HeliCopter extends TakeOffSystem{ public void fly(){ System.out.println("直升机起飞了"); } public void land(){ System.out.println("直升机降落了"); } } class GunDam extends TakeOffSystem{ public void fly(){ System.out.println("高达起飞了"); } public void land(){ System.out.println("高达降落了"); } } public class FlyTest{ public static void main(String[] args) { TakeOffSystem a = new BattlePlan(); TakeOffSystem b = new HeliCopter(); TakeOffSystem c = new GunDam(); a.fly(); a.land(); b.fly(); b.land(); c.fly(); c.land(); } }