本帖最后由 左耳的鱼 于 2013-7-21 17:54 编辑
class Vehicle { public void drive() { System.out.println("Vehicle: drive"); } } class Car extends Vehicle { public void drive() { System.out.println("Car: drive"); } } public class Test { public static void main (String args []) { Vehicle v; Car c; v = new Vehicle(); c = new Car(); v.drive(); c.drive(); v = c; v.drive(); } }// Vehicle: drive Car: drive Car: drive 为什么是这个结果 |