我按照java核心编程中的代码输入 public Employee clone() throws CloneNotSupportedException{
Employee cloned=(Employee)super.clone();
cloned.hireday=(Date) hireday.clone();
return cloned;
}为什么会有The return type is incompatible with Object.clone()的错误呢
Employee cloned=(Employee)super.clone();
cloned.hireday=(Date) hireday.clone();
return cloned;
}为什么会有The return type is incompatible with Object.clone()的错误呢
@Override
protected Object clone() throws CloneNotSupportedException {
// TODO Auto-generated method stub
return super.clone();
}
public Object clone() throws CloneNotSupportedException{
Employee cloned=(Employee)super.clone();
cloned.hireday=(Date) hireday.clone();
return cloned;
}