父类构造函数及子类构造函数 子类调用父类方法
public class Vehicle{
String brand;
String color;
int price;
int number;
public Vehicle(String b,String c){
this.brand = b;
this.color = c;
}
public Vehicle(String b,String c,int p,int n){
this(b,c);
this.price = p;
this.number = n;
}
void print(){};
}
class Car extends Vehicle{
int speed;
Car(String b,String c,int p,int n,int s){
super(b,c,p,n);
this.speed = s;
}
void print(){
super.print();
System.out.print("speed=" + this.speed);
}
}