public void setSpeed(int speed)
{
this.speed=speed;
}
public void move()
{
System.out.println("移动!");
}
public void stop()
{
System.out.println("停止!");
}
public void toString(){
System.out.println("名字"+getName()+"品牌"+getBrand()+"颜色"+getColor+"车牌号"+getNumber()+"车速"+getSpeed());
}
public static void main(String args[]) //显示类一般是给用户提供需求信息的部分叫 view
{
Vehicle v = new Vehicle("名字","品牌","颜色","车牌号");
Truck t = new Truck("名字","品牌","颜色","车牌号",60);
v.toString();
t.toString();
}
}