- class java0405d1
- {
- public static void main(String[] args)
- {
- System.out.println("怎一乱字了得");
- JingLi kao=new JingLi("lishi","NPC",10000,10000);
- pro cao = new pro("wangwu","W3C",1000);
- kao.gongzuo();
- cao.gongzuo();
- }
- }
- abstract class YuanGong
- {
- private String name;
- private String id;
- private double pay;
- YuanGong(String name,String id,double pay)
- {
- this.name=name;
- this.id=id;
- this.pay=pay;
- }
- public abstract void gongzuo();
- }
- class JingLi extends YuanGong
- {
- private int jiangjin;
- JingLi(String name,String id,double pay,int jiangjin)
- {
- super(name,id,pay);
- this.jiangjin=jiangjin;
- }
- public void gongzuo()
- {
- System.out.println("我是经理 我的心太乱");
- }
- }
- class pro extends YuanGong
- {
- pro(String name,String id,double pay)
- {
- super(name,id,pay);
- }
- public void gongzuo()
- {
- System.out.println("我是普通员工 我恨经理这个二叉树");
- }
- }
复制代码 自己改着玩的... |