java核心技术I中158页有这句,return String.format("an employee with a salary of $%.2f", salary);,salary是double型的,可是API文档中是public static String format(String format,Object... args),后面应该是Object型才对啊,为什么呢
调试欢乐多
class Employee extends Person{
private double salary;
private Date hireDay; public Employee(String n,double s,int year,int month,int day){
super(n);
salary=s;
GregorianCalendar calendar=new GregorianCalendar(year,month-1,day);
hireDay=calendar.getTime();
} public Date getHireDay() {
return hireDay;
} public double getSalary() {
return salary;
}
public String getDescription(){
return String.format("an employee with a salary of $%.2f", salary);
}
public void raiseSalary(double byPercent){
double raise=salary*byPercent/100;
salary+=raise;
}
}