Java中的类不支持多重继承,即一个类只能有一个超类。接口作为一种程序结构,很好地解决了这一问题,实现多重继承的功能。
package JAVA_Project_01_05;
class Employee {
private String name;
private String gender;
private int age;
private int salary;
public Employee(String name, String gender, int age, int salary) {
super();
this.name = name;
this.gender = gender;
this.age = age;
this.salary = salary;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
}
interface PersonForm {