public class Demo {
public static void main(String[] args) {
new Student().work();
new Worker().work();
new StudentLeader().meeting();
}
}
abstract public class Person_1 {
private String name;
private String gender;
private int age;
private String nationality;
public abstract void work();
public void eat(){
}
public void sleep(){
}
}
class Student extends Person_1 {
private String school;
private int stuNumber;
@Override
public void work() {
System.out.println("学生在学习");
}
}
class Worker extends Person_1{
private String unit;
private int workAge;
@Override
public void work() {
System.out.println("工人在盖房子");
}
}
class StudentLeader extends Student{
private String job;
public void meeting(){
System.out.println("学生干部喜欢开会");
}
}
|
|