black

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.运行时抛出异常

相关考题

多项选择题 下列哪些方法是在编译时刻绑定的?()

单项选择题 现有:      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){     System.out.println ("Erase "+content);     }     } 执行下列代码的结果是哪项?()  Pencil pen=new RubberPencil();      pen.write("Hello");

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

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3