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;
}
public abstract void work();
}
class Manager extends Employee
{
private int bonus;
Manager(string name,string id,double pay,int bonus)
{
super(name,id,pay);
this.bonus=bonus;
}
public void work()
{
System.out.println("manager work");
}
}
class Pro extends Employee
{
class Pro(string name,string id,double pay)
{
super(name,id,pay);
}
public void work()
{
System.out.println("Pro work");
}
}
public class AbstactDemo
{
public static void main(String[] args)
{
Manager man=new Manager(zhansan,01,100.00,400 );
Pro p=new Pro(lisi,05,200.00);
man.work();
p.work();
}
}
我在编译时,AbstractDemo.java:29: 错误: 需要'{'
class Pro(string name,string id,double pay)
^
AbstractDemo.java:29: 错误: 需要';'
class Pro(string name,string id,double pay)
^
AbstractDemo.java:48: 错误: 进行语法分析时已到达文件结尾
} |