public class Car {
public int fadongji;
public int luntai;
public int oil;
public Car(){
System.out.println("父类构造方法被执行了");
}
}
public class che extends Car{
public che(){
System.out.println("子类构造方法被执行了");
}
}
public class UseChe {
public static void main(String[] args){
che c=new che();
c.fadongji=55;
c.luntai=12;
c.oil=12;
}
}
为什么在子类父类的构造方法里面加上void 就不输出SYSO 语句了 但是去掉void 就执行了 输出语句呢??
慕后端3352169
望远
相关分类