hc学习平台

 找回密码
 立即注册
搜索
热搜: 活动 交友 javakc
 › lijiaoluo › 日志

what will be the output when you compile and execute the following program  

2022-02-11 10:13:30 查看(179) 回复(0)

class  Base{
    static  void  test(    ){
        System.out.println("Base.test(  )");
    }
}
public  class  Child  extends  Base{
    void  test(  ){
        System.out.println("Child.test(  )");
  Base.test(  );
    }
    static  public  void  main(String[  ]  a){
        Child  anObj=new  Child(  );
        anObj.test(  );
    }
}
Select  most  appropriate  answer
A、Child.test(    )
Base.test(    )
B、Compilation  error.cannot  override  a  static  method  by  an  instance  method
C、Runtime  error.  Cannot  override  a  static  method  by  an  instance  method
D、Child.test(    )
Child.test(    )
B

评论 (0 个评论)

facelist

全部作者的其他最新日志



站点统计|举报|Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, , Processed in 0.195171 second(s), 9 queries .

Powered by javakc! X1.0

© 2004-2014 javakc

f1208.com 备案号:京ICP备14030918号-1

返回顶部