单项选择题

Given:
3. class Bonds {
4. Bonds force() {return new Bonds(); }
5. }
6. public class Covalent extends Bonds {
7. Covalent force() {return new Covalent(); }
8. public static void main(String[] args) {
9. new Covalent() .go(new Covalent());
10. }
11. void go(Covalent c) {
12. go2(new Bonds() .force(), c.force());
13. }
14. void go2(Bonds b, Covalent c) {
15. Covalent c2 = (Covalent)b;
16. Bonds b2 = (Bonds)c;
17. } }
What is the result (Choose all that apply.)

A.A ClassCastException is thrown at line 15.
B.A ClassCastException is thrown at line 16.
C.Compilation fails due to an error on line 7.
D.Compilation fails due to an error on line 12.
E.Compilation fails due to an error on line 15.
F.Compilation fails due to an error on line 16.
题目列表

你可能感兴趣的试题

微信扫码免费搜题