当前位置: 答题翼 > 问答 > 计算机类考试 > 正文
目录: 标题| 题干| 答案| 搜索| 相关
问题

现有:classPencil{publicvoidwrite(Stringcontent){System.out.println("Write"+conte


现有:classPencil{publicvoidwrite(Stringcontent){System.out.println("Write"+content);}}classRubberPencilextendsPencil{publicvoidwrite(Stringcontent){System.out.println("RubberWrite"+content);}publicvoiderase(Stringcontent){System.out.println("Erase"+content);}}执行下列代码的结果是哪项?()Pencilpen=newRubberPencil();pen.write("Hello");

A、WriteHello

B、RubberWriteHello

C、编译错误

D、运行时抛出异常

参考答案
您可能感兴趣的试题
  • 此处,Something 类的文件名叫OtherThing.javaclass Something {private static void main(Stri

  • 此处,Something 类的文件名叫OtherThing.javaclass Something {private static void main(Stri

  • Operator overloading operator+= which appends another String instance into current Stri

  • Operator overloading operator+= which appends another String instance into current Stri

  • A conversion operator which converts the current String instance into raw C-style. stri

  • A conversion operator which converts the current String instance into raw C-style. stri