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

问题:

[单选]

1. public class A { 
2. 
3. private int counter = 0; 
4. 
5. public static int getInstanceCount() { 
6. return counter; 
7. } 
8. 
9. public A() { 
10. counter++; 
11. } 
12. 
13. } 
Given this code from Class B: 
25.A a1 =new A(); 
26. A a2 =new A(); 
27. A a3 =new A(); 
28. System.out.printIn(A.getInstanceCount() );
What is the result?() 

A .  Compilation of class A fails.
B .  Line 28 prints the value 3 to System.out.
C .  Line 28 prints the value 1 to System.out.
D .  A runtime error occurs when line 25 executes.
E .  Compilation fails because of an error on line 28.

幕职官 日最高气温出现在(),日最低气温出现在()前后。 午后,日出。 日出,凌晨。 午后,凌晨。 日出,午后。 论著()奠定了维尔达夫斯基在西方行政学尤其是公共预算研究领域的崇高学术地位。 《预算过程的新政治》。 《反叛民众以及关于政治与公共政策的其他论文》。 《赤字与公共利益》。 《预算过程的政治》。 麦格雷戈人事管理理论的思想基础是()。 资源配置说。 组织行为说。 人力资源说。 需要层次说。 下列质量问题常见成因中,不属于预制桩桩身断裂成因的是()。 制作桩时,桩身弯曲超过规定,桩尖偏离桩的纵轴线较大,沉入过程中桩身发生倾斜或弯曲。 桩入土后,遇到大块坚硬的障碍物,把桩尖挤向一侧。 稳桩不垂直,压入地下一定深度后,再用走架方法校正,使桩产生弯曲。 土质松软。

1. public class A { 
2. 
3. private int counter = 0; 
4. 
5. public static int getInstanceCount() { 
6. return counter; 
7. } 
8. 
9. public A() { 
10. counter++; 
11. } 
12. 
13. } 
Given this code from Class B: 
25.A a1 =new A(); 
26. A a2 =new A(); 
27. A a3 =new A(); 
28. System.out.printIn(A.getInstanceCount() );
What is the result?() 

参考答案:

  参考解析

本题暂无解析

在线 客服