java面向对象-CommissionWorker类是 Employee类的继承这句话要怎么解释?
public final class CommissionWorker extends Employee{
private double salary;
private double commission;
private int quantity;
public CommissionWorker(String frist,String last,double s,double c,int q)
{
super(frist,last);
setSalary(s);
2012/7/17(c);
setQuantity(q);
}
public void setSalary(double s)
{
salary=(s>0?s:0);
}
public void setCommission(double c)
{
commission=(c>0?c:0);
}
public void setQuantity(int q)
{
quantity=(q>0?q:0);
}
public double earnings()
{
return salary+commission+quantity;
}
public String toString()
{
return ""+super.toString();
}
}
在最后一个return 中“ ?” 这个能是空的字符串吗?要是不可以 这里需要怎么写?
|