今天学习基础,本人小萌新,发表一点今天联系的代码,继续加油。
public class Person {
private String name;
private String gender;
private int age;
private String nationality;
public void eat(){
System.out.println("吃饭");
}
public void sleep(){
System.out.println("睡觉");
}
public void work(){
System.out.println("工作");
}
}
public class Student extends Person {
private String school;
private int stuNumber;
public Student() {
}
public Student(String name, String gender, int age, String nationality) {
}
@Override
public void work() {
System.out.println("学生需要学习!");
}
}
public class StudentLeader extends Student {
private String jod;
public StudentLeader(){}
public StudentLeader(String name, String gender, int age, String nationality){
}
public void meeting(){
System.out.println("学生干部喜欢开会!");
}
}
public class Test {
public static void main(String[] args) {
Student s = new Student();
s.work();
Worker w = new Worker();
w.work();
StudentLeader sL = new StudentLeader();
sL.meeting();
}
}
就是这些了,继续努力 |
|