abstract class Worker
{
Worker(String name,String id,double pay)
{
this.name=name;
this.id=id;
this.pay=pay;
}
private String name;
private String id;
private double pay;
public abstract void job();
}
class Staff extends Worker
{
Staff(String name,String id,double pay)
{
super(name,id,pay);
}
public void job()
{
System.out.println("yuangong ...gongzuo");
}
}
class Manager extends Worker
{
Manager(String name,String id,double pay,double money)
{
super(name,id,pay);
this.money=money;
}
private double money;
public void job()
{
System.out.println("jingli....gongzuo");
}
}
class LianDemo
{
Staff st = new Staff("zhangsan","123",4000);
st.job(); //提示 这里错了
Manager m=new Manager("lisi","321",5000,2000);
m.job(); //提示 这里错了
}
2个错误
LianDemo.java:50: 错误: 需要<标识符>
st.job();
^
LianDemo.java:52: 错误: 需要<标识符>
m.job();
^
这是错到哪里了? |