//父类
public class Animal {
String sleep,eat;
public Animal(){
System.out.println("睡觉");
//程序说吃肉未被读取。哪里出错了啊?
}
}
//子类
public class Lion extends Animal {
public Lion(String eat){
this.eat=eat;
System.out.println("狮子是吃"+this.eat);
}
public static void main(String[] args){
Rabbit a=new Rabbit("吃肉");
}
|
|