求解,大神
public abstract class Employee{
private String name;
public Employee (String name){
this.name=new String(name);
}
public String getName(){
return name;
}
public abstract double enrning();
}
public final calss Boss extends Employee{
private double weeeklySalary;
public Boss(String name,double weeklySalary){
super(name);
setWeeklySalary(WeeklySalary);
}
public void setWeeklySalary(double WeeklySalary){
if(WeeklySalary<0) this.WeeklySalary=0;
else this.WeeklySalary=WeeklySalary;
}
public double earnings(){
return WeeklySalary;
}
public String toString(){
return"Boss"+getName()+"每周挣"+WeeklySalary+"元";
}
}
父类中的 this.name=new String(name);
子类中的 super(name);分别是什么意思?