多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

现有:      class Pencil  {  public void write (String content){     System.out.println( "Write",+content){     }     }class RubberPencil extends Pencil{     public void write (String content){  System.out.println("Rubber Write"+content);     }  public void erase (String content)}}  执行下列代码的结果是哪项?()      Pencil  pen=new  Pencil();  (( RubberPencil) pen).write( "Hello");    

  • A、Write Hello
  • B、Rubber Write Hello
  • C、编译失败
  • D、运行时抛出异常
正确答案:D
答案解析:
进入题库查看解析

微信扫一扫手机做题