欢迎来到易学考试网 易学考试官网
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

10. interface A { void x(); } 
11. class B implements A { public void x() { } public voidy() { } } 
12. class C extends B { public void x() {} } 
And: 
20. java.util.List list = new java.util.ArrayList(); 
21. list.add(new B()); 
22. list.add(new C()); 
23. for (A a:list) { 
24. a.x(); 
25. a.y();; 
26. } 
What is the result?() 
 

    A. The code runs with no output.
    B. An exception is thrown at runtime.
    C. Compilation fails because of an error in line 20.
    D. Compilation fails because of an error in line 21.
    E. Compilation fails because of an error in line 23.
    F. Compilation fails because of an error in line 25.

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题