black

Java认证考试综合练习

登录

单项选择题

class Guy { String greet() { return "hi "; } } 
class Cowboy extends Guy { String greet() { return "howdy "; } } 
class Wrangler extends Cowboy { String greet() { return "ouch! "; } } 
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.hi howdy ouch!
C.ouch! howdy ouch!
D.编译失败

相关考题

单项选择题 JavaSEJDK中类库java.text的用途是哪项?()

单项选择题 class WhileTests { public static void main(String [] args) {  int x = 5;  while (++x 〈 3) {  --x;  }  System.out.println("x = " + x);  }  } 结果是什么?()

单项选择题 class DemoApp{  public static void main(String[] args){  int x = 5; int y = ++x + x++; S ystem.out.println(“y=”+y+”,x=”+x);  }  }  以上程序运行后的输出结果是哪项?()

All Rights Reserved 版权所有©求知题库网库(csqiuzhi.com)

备案号:湘ICP备14005140号-1

经营许可证号:湘B2-20140064