日期:2014-05-20 浏览次数:20817 次
abstract class Vehicle { public int speed(){ return 0; } } class Car extends Vehicle{ public int speed(){ return 60; } } class RaceCar extends Car{ public int speed(){ return 150; } } public class Test{ public static void main(String[] args) { RaceCar racer = new RaceCar(); Car car = new RaceCar(); Vehicle vehicle= new RaceCar(); System.out.println(racer.speed() + "," + car.speed() + "," + vehicle.speed()); } }
------解决方案--------------------