当前位置:SCJP程序员认证考试题库

问题:

[单选]

1. class A { 
2. public int getNumber(int a) { 
3.     return a + 1; 
4. } 
5. } 
6.   
7. class B extends A { 
8. public int getNumber (int a) { 
9. return a + 2 
10. } 
11.   
12. public static void main (String args[])  { 
13. A a = new B(); 
14. System.out.printIn(a.getNumber(0)); 
15.    }
16. }    
What is the result?()  

A .  Compilation succeeds and 1 is printed.
B .  Compilation succeeds and 2 is printed.
C .  An error at line 8 causes compilation to fail.
D .  An error at line 13 causes compilation to fail.
E .  An error at line 14 causes compilation to fail.

存在外部性时,社会边际成本与私人边际成本、社会边际收益与私人边际收益都不一定相等 《山居秋暝》 简述水土保持生态修复的成效? 炮检距 民族传统体育

1. class A { 
2. public int getNumber(int a) { 
3.     return a + 1; 
4. } 
5. } 
6.   
7. class B extends A { 
8. public int getNumber (int a) { 
9. return a + 2 
10. } 
11.   
12. public static void main (String args[])  { 
13. A a = new B(); 
14. System.out.printIn(a.getNumber(0)); 
15.    }
16. }    
What is the result?()  

参考答案:

  参考解析

本题暂无解析

在线 客服