此代码显示了当给定参数的长度和类型相同时,构造函数的实际参数和格式参数在长度错误方面有所不同。这是构造器
class OfficialRecipient extends Recipient{
private String designation;
public OfficialRecipient(String name, String email_address, String designation){
super(name,email_address);
this.designation=designation;
}
这是我创建新对象的地方。
public void addOfficialRecipient(String name,String email_address,String designation){
OfficialRecipient friend = new OfficialRecipient(name,email_address,designation);
}
它给出了这个错误。
constructor OfficialRecipient in class OfficialRecipient cannot be applied to given types;
required: no arguments
found: String,String,String
reason: actual and formal argument lists differ in length