现有: class Guy { String greet() { return "hi"; } } class Cowboy extends Guy { String greet() { return. "howdy";}} class Wrangler extends Cowboy { String greet() { return "orch!"; } } class Greetings2 { public static void main (String [] args) { Guy g=new Wrangler(); Guy g2=new Cowboy(); Wrangler w2=new Wrangler(); System. out .print (g.greet()+g2.greet()+w2 .greet()); } } 结果是什么?()
- A、 hi hi ouch!
- B、 ouch! howdy ouch!
- C、 hi howdy ouch!
- D、编译失败
- E、运行的咐候有异常抛出
正确答案:B
答案解析:有
微信扫一扫手机做题