[java]代码库
class People{
public String name;
public String sex;
}
public class Employee extends People{
public int age;
public char grade;
public Employee(){
this("老王","男",40,'A');
}
public Employee(String name,String sex,int age,char grade){
this.name = name;
this.sex = sex;
this.age = age;
this.grade = grade;
}
public String print(){
return "姓名:" + name + ";\t\t性别:" + sex + ":\t\t年龄:" + age +
":\t\t工资:" + grade ;
}
public static void main(String[] args) {
Employee employee = new Employee();
System.out.println(employee.print());
}
}