可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

10. interface Foo {&en


10. interface Foo {  11. int bar();  12. }  13.  14. public class Beta {  15.  16. class A implements Foo {  17. public int bar() { return 1; }  18. }  19.  20. public int fubar( Foo foo) { return foo.bar(); }  21.  22. public void testFoo() {  23.  24. class A implements Foo {  25. public int bar() { return 2; }  26. }  27.  28. System.out.println( fubar( new A())); 29. }  30.  31. public static void main( String[] argv) {  32. new Beta().testFoo();  33. }  34. }  Which three statements are true?()

  • A Compilation fails.
  • B The code compiles and the output is 2.
  • C If lines 16, 17 and 18 were removed, compilation would fail.
  • D If lines 24, 25 and 26 were removed, compilation would fail.
  • E If lines 16, 17 and 18 were removed, the code would compile and the output would be 2.
  • F If lines 24, 25 and 26 were removed, the code would compile and the output would be 1.
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、若a=5,b=3,c=4,逻辑表达式!(a+b)&;&;!c的值

若a=5,b=3,c=4,逻辑表达式!(a+b)&;&;!c的值为()A0B-1C1D2

2、public interface Foo{ 

public interface Foo{ int k = 4; }  Which three are equivalent to line 2?() &ensp...

3、public interface Foo {

public interface Foo { int k = 4; 3. } Which three are equivalent to line 2?()A&e...

4、10. interface Foo {&en

10. interface Foo { int bar(); } 11. public class Sprite { 12. public int fubar( ...

5、10. interface Foo {}&e

10. interface Foo {} 11. class Alpha implements Foo {} 12. class Beta extends Alpha {}&ens...

6、表达式10>5&&6%3的值是()

表达式10>5&&6%3的值是()A-1B非零值C0D1