[问答题] 阅读和理解下面程序段:
class Manager extends Employee
public Manager(String n,double s,int year,int month,int day)
super(n,S,year,month,day);
bonus=0;
public double getSalary()
double baseSalary=super.gerSalary();
return baseSalary+bonus;
public void setBonus(double B) bonus=b;
private double bonus;
Manager是Employee的子类,其理由是( )。
正确答案:B
参考解析:本题考查Java中子类的概念。Java中通过在类声明中加入extends子句来创建子类,格式为:class SubClass extens SuperClass{...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)