class Employee
{
private String name;
private String id;
private double pay;
Employee(String name,String id,double pay)
{
this.name=name;
this.id=id;
this.pay=pay;
}
}
class Manager extends Employee
{
private int bonus;
Manager(String name,String id,double pay,int bonus)
{
super(name,id,pay);
this.bonus=bonus;
System.out.println("name="+this.name+"...id="+this.id+"...pay="+this.pay+"...bonus="+this.bonus);
}
public void work()
{
System.out.println("Manager work");
}
}
class Half
{
public static void main(String[] args)
{
Manager c2=new Manager("wangwu","002",4500,1000);
c2.work();
}
}
为什么类Manager中的语句System.out.println("name="+this.name+"...id="+this.id+"...pay="+this.pay+"...bonus="+this.bonus);不能正确执行???
请具体解释一下。
|