java汽车接口类代码 java接口编写教程( 三 )


this.num = num;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String inforShow() {
return "Car [num=" + num + ", name=" + name + ", price=" + price + "]";
}
}
public class PriCar extends Car{
private int PersonNum;//最大载客量
public PriCar(int personNum) {
super();
PersonNum = personNum;
}
public PriCar() {
super();
}
public int getPersonNum() {
return PersonNum;
}
public void setPersonNum(int personNum) {
PersonNum = personNum;
}
@Override
public String inforShow() {
return "PriCar [PersonNum=" + PersonNum + "]";
}
}
public class VanCar extends Car {
private double weight;//最大载重
public VanCar(double weight) {
super();
this.weight = weight;
}
public VanCar() {
super();
}
@Override
public String inforShow() {
return "PriCar[num=" + super.getNum() + ", name=" + super.getName() + ", price=" + super.getPrice() +",weight=" + weight + "]";
}
}
测试类不想写了应该可以自己写出来了吧
【java汽车接口类代码 java接口编写教程】关于java汽车接口类代码和java接口编写教程的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读