親クラスは…
public class UMember {
private String first;
private String last;
private String street;
private String city;
private String state;
private String zipcode;
public UMember() {
this("na", "na", "na", "na", "na", "na");
}
public UMember(String first, String last, String street,
String city, String state, String zipcode){
set(first, last, street, city, state, zipcode);
}
private void set(String first, String last, String street,
String city, String state, String zipcode){
this.first = first;
this.last = last;
this.street = street;
this.city = city;
this.state = state;
this.zipcode = zipcode;
}
public void setUMember(String first, String last, String street,
String city, String state, String zipcode) {
set(first, last, street, city, state, zipcode);
}
UMember の親サブクラスは...
public class Employee extends UMember {
private int eid;
private String doh;
private String dept;
private double salary;
public Employee() {
this(0, "na", "na", 0.0, "na", "na", "na", "na", "na", "na");
}
public Employee(int eid, String doh, String dept, double salary) {
this(eid, doh, dept, salary, "na", "na", "na", "na", "na", "na");
}
public Employee(int eid, String doh, String dept, double salary,
String first, String last, String street, String city,
String state, String zipcode) {
super(first, last, street, city, state, zipcode);
set(eid, doh, dept, salary);
}
private void set(int eid, String doh, String dept, double salary) {
this.setEid(eid);
this.setDoh(doh);
this.setDept(dept);
this.setSalary(salary);
}
private void setEmployee(int eid, String doh, String dept, double salary,
String first, String last, String street, String city,
String state, String zipcode) {
setUMember(first, last, street, city, state, zipcode);
set(eid, doh, dept, salary);
}
Employee のサブクラスは...
public class Faculty extends Employee{
private String rank;
private int annualTeachingLoad;
public Faculty() {
this("na", 0, 0, "na", "na", 0.0,
"na", "na", "na", "na", "na", "na");
}
public Faculty(String rank, int annualTeachingLoad) {
this(rank, annualTeachingLoad, 0, "na", "na", 0.0,
"na", "na", "na", "na", "na", "na");
}
上記の教員サブクラスのデフォルト コンストラクタはどちらも正しくありません。理由がわかりません。最初に教員、次に従業員、最後に UMember のデフォルト値を使用しています。これらのコードの両方が正しくない理由についての助けをいただければ幸いです。