单项选择题
现有:
1.class SuperFoo{
2.SuperFoo doStuff (int x) {
3.return new SuperFoo();
4. }
5. }
6.
7. class Foo extends SuperFoo {
8. //insert code here
9. }
和四个声明:
Foo doStuff (int x) { return new Foo(); }
Foo doStuff (int x) { return new SuperFoo(); }
SuperFoo doStuff(int x) { return new Foo(); }
SuperFoo doStuff(int y) { return new SuperFoo(); }
分别插入到第8行,有几个可以通过编泽?()
A. 1
B. 2
C. 3
D. 4
点击查看答案&解析
相关考题
-
单项选择题
现有: class Bird { void talk() { System.out.print("chirp "); } } class Parrot2 extends Bird { protected void talk() { System.out.print("hello "); public static void main(String [] args) { Bird [] birds = {new Bird(), new Parrot2 () }; for( Bird b : birds) b.talk () ; } } 结果是什么 ?()
A. chirp chirp
B. hello hello
C. chirp hello
D.编译错误 -
单项选择题
现有 class Beverage { Beverage () { System.out.print ("beverage "); } } class Beer extends Beverage { public static void main{string [] args) { Beer b = new Beer (14) ; } public int Beer(int x) { this () ; System.out.print ("beerl") ; } public Beer() { System.out.print("beer2 "); } } 结果是什么?()
A.beerl beverage
B.beer2 beverage
C.beverage beer2 beerl
D.编译失败 -
单项选择题
现有: 1.class Over { 2.int dolt (long x) { return 3; } 3. } 4. 5. class Under extends Over { 6.//insert code here 7. } 和四个方法: short dolt (int y) { return 4; } int dolt(long Xr long y) { return 4; } private int dolt(short y) { return 4; } protected int dolt (long x) { return 4; } 分别插入到第6行,有几个可以通过编译?()
A. 1
B. 2
C. 3
D. 4
