本帖最后由 mono 于 2015-4-14 16:37 编辑
看了视频跟老师敲了一遍代码可是不知道怎么在主函数初始化Manager类的值,求帮忙;
- 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 Mannager extends Employee
- {
- private int bonus;
- Mannager(String name,String id,double pay,int bonus)
- {
- super(name,id,pay);
- this.bonus=bonus;
- }
- public void work()
- {
- System.out.println("manager work");
- }
-
- }
- class Demo
- {
- public static void main(String[] args)
- {
- /*如何为Mannager定义初始化值并打印?*/
- }
- }
复制代码 |
|