class Person{
String id;
String name;
String age;
public void sleep(){
System.out.println("IamPerson,Iamsleeping");
}
public void eat(){
System.out.println("IamPerson,Iameating");
}
}
class Student extends Person{
public void sleep(){
System.out.println("熬夜加班秃头党");}
public void eat(){
System.out.println("我是学生,我吃吃吃");}
public void study(){
System.out.println("又是学习的一天");}
public void sno(String a){
System.out.println("看不懂是什么");}
}
class Teacher extends Person{
public void sleep(){
System.out.println("好老师,睡得香");}
public void eat(){
System.out.println("老师吃");}
public void teach(){
System.out.println("今天教了好多学生呢");}
public void tid(){}
public static void askAllToEat(Person[]ps)
{for(int i=0;i<ps.length;i++){
ps[i].eat();
ps[i].sleep();}}
}
class B2{
public static void main(String[] args) {
Person a= new Student();
a.eat();
Teacher b= new Teacher();
b.askAllToEat(12);
}}
B2.java:46: 错误: 不兼容的类型: int无法转换为Person[]
b.askAllToEat(12);
^