现有: 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");
- A、 Write Hello
- B、 Rubber Write Hello
- C、编译错误
- D、运行时抛出异常
正确答案:B
答案解析:有
微信扫一扫手机做题