public class VehicleTest {
public static void main(String args[]) {
Vehicle c;
c = new Vehicle();
c.setVehicle("benz", "yellow");
c.run();
c.access("benz", "black", 300);
c.run();
}
}
public class Car extends Vehicle {
int loader;
void access(String brand,String color,double speed,int loader) {
this.brand=brand;
this.color=color;
this.speed=speed;
this.loader=loader;
}
void run() {
System.out.println("该汽车的品牌为:"+this.brand+"颜色为"+this.color+"速度为"+this.speed+"核载人数"+this.loader);;
}
}