22 lines
434 B
Java
22 lines
434 B
Java
|
package exp3;
|
||
|
|
||
|
public class Trunk extends Car {
|
||
|
//成员属性
|
||
|
float payload;
|
||
|
|
||
|
public Trunk(){
|
||
|
super();
|
||
|
this.payload = 0;
|
||
|
}
|
||
|
|
||
|
public Trunk(String brand, int wheels, float weight, int loader, float payload){
|
||
|
super(brand, wheels, weight, loader);
|
||
|
this.payload = payload;
|
||
|
}
|
||
|
|
||
|
void show(){
|
||
|
super.show();
|
||
|
System.out.println("载重数: "+this.payload);
|
||
|
}
|
||
|
}
|