Java继承 - 找不到符号构造函数

Dan*_*pel 3 java inheritance

即使它调用超类构造函数,我也无法弄清楚如何编译我的子类?

这是不能编译的类:

package departments;
import employees.*;

public class DepartmentEmployee extends Employee{

    private Department department;

    public DepartmentEmployee(Profile profile, Address address, Occupation occupation,   Department department) {
        assert (department != null) : "invalid Department";
        super(profile, address, occupation);
        this.department = department;
    }

}
Run Code Online (Sandbox Code Playgroud)

这是超类:

package employees;

public class Employee {

    protected Profile profile;
    protected Address address;
    protected Occupation occupation;

    protected Employee(Profile profile, Address address, Occupation occupation) {
        assert (profile != null) : "invalid Profile";
        assert (address != null) : "invalid Address";
        assert (occupation != null) : "invalid Occupation";
        this.profile = profile;
        this.address = address;
        this.occupation = occupation;
    }

}
Run Code Online (Sandbox Code Playgroud)

子类继续说"找不到符号 - 构造函数Employee".这两个是不同的包.我是否正确链接了它们?

Bal*_*usC 6

super()需求是第一个在构造函数中调用.将其重新排列在上方assert.

也可以看看:

调用超类构造函数必须是子类构造函数中的第一行.