现有: class Guy {String greet() {return "hi"; } } class Cowboy extends Guy ( String greet() ( return "howdy ¨; ) ) class Surfer extends Guy (String greet() (return "dude! ";)) class Greetings { public static void main (String [] args) { Guy [] guys = ( new Guy(), new Cowboy(), new Surfer() ); for (Guy g: guys) System.out.print (g.greet()}; } } 结果为:()
- A、 hi howdy dude!
- B、运行时异常被抛出。
- C、第7行出现一个错误,编译失败。
- D、第8行出现一个错误,编译失败。
正确答案:A
答案解析:有
微信扫一扫手机做题