标签:
classPerson{
String name;
int age;
void eat(){
System.out.println("吃饭");
}
void introduce(){
System.out.println("我的名字是"+ name +",我的年龄是"+ age);
}
}
classStudent extends Person{
int grade;
void study(){
System.out.println("学习");
}
}
classTeacher extends Person{
}
classTest{
publicstaticvoid main(String args []){
Student student =newStudent();
student.name ="张三";
student.age =20;
student.grade =3;
student.eat();
student.introduce();
student.study();
}
}
标签:
原文地址:http://www.cnblogs.com/arroneve/p/5815431.html