分类信息
各地考试

当前位置:首页 » Java认证 » 历年真题 » 正文

SCJP认证历年经典考题(6)


时间:2013-10-22 来源:Java认证考试网 浏览次数:168  【华夏培训网:中国教育培训第一门户

QuestionNo25 Given: 1.abstractclassabstrctIt{ 2.abstractfloatgetFloat(); 3.) 4.publicclassAbstractTestextendsAbstractIt

Question No 25 
Given: 
1. abstract class abstrctIt { 
2. abstract float getFloat (); 
3. ) 
4. public class AbstractTest extends AbstractIt { 
5. private float f1= 1.0f; 
6. private float getFloat () {return f1;} 
7. } 
What is the result? 
A. Compilation is successful. 
B. An error on line 6 causes a runtime failure. 
C. An error at line 6 causes compilation to fail. 
D. An error at line 2 causes compilation to fail. 
Answer: C 

Question No 26 
Exhibit: 
1. public class test( 
2. public int aMethod()[ 
3. static int i=0; 
4. i++; 
5. return I; 
6. ) 
7. public static void main (String args){ 
8. test test = new test(); 
9. test.aMethod(); 
10.int j = test.aMethod(); 
11.System.out.printIn(j); 
12.] 
13.} 
What is the result? 
A. Compilation will fail. 
B. Compilation will succeed and the program will print “0” 
C. Compilation will succeed and the program will print “1” 
D. Compilation will succeed and the program will print “2” 
Answer: D 

Question No 27 
Given: 
1. class super { 
2. public float getNum() {return 3.0f;} 
3. ) 
4. 
5. public class Sub extends Super { 
6. 
7. ) 
Which method, placed at line 6, will cause a compiler error? 
A. Public float getNum() {return 4.0f; } 
B. Public void getNum () { } 
C. Public void getNum (double d) { } 
D. Public double getNum (float d) {retrun 4.0f; } 
Answer: B 





       Java认证

推荐图文

热门点击排行

©2015 hxpx.com All Rights Reserved 滇ICP备13002816号-1
华夏培训网唯一网址www.hxpx.com