abstract class Ren
{
private String name;
private String gonghao;
private int gongzi;
Ren(String name,String gonghao,int gongzi)
{
this.name =name;
this.gonghao =gonghao;
this.gongzi =gongzi;
}
public abstract void gongzuo();
}
class Yuangong extends ren
{
Yuangong(String name,String gonghao,int gongzi)
{
super(name,gonghao,gongzi);
}
public void gongzuo()
{
System.out.println("一般工作");
}
}
class JinLi extends ren
{
private double jiangji;
JinLi(String name,String gonghao,int gongzi,double jiangji)
{
super(name,gonghao,gongzi);
this.jiangji = jiangji;
}
public void gongzuo()
{
System.out.println("管理工作");
}
}
class LianXi6
{
public static void main(String[] args)
{
Yuangong yuan=new Yuangong("张三","开发0002",8000);
yuan.gongzuo();
JinLi jinli=new JinLi("张三","开发0002",80000,);
jinli.gongzuo();
}
}
还是希望你的输写方法主意点啊
类名:首字要大写
变量名:第二字母首字母也需要 大字
希望养成好的编程习惯
|