分类信息
SCJP认证历年经典考题(7)
时间:2013-10-22
来源:Java认证考试网 浏览次数:88
【华夏培训网:中国教育培训第一门户】
QuestionNo28 Whichdeclarationpreventscreatingasubclassofanouterclass? A.StaticclassFooBar{} B.PrivateclassFooBar{} C.Ab
Question No 28
Which declaration prevents creating a subclass of an outer class?
A. Static class FooBar{}
B. Private class FooBar{}
C. Abstract public class FooBar{}
D. Final public class FooBar{}
E. Final abstract class FooBar{}
Answer: D
Question No 29
Given:
1. byte arry1, array2;
2. byte array3 ;
3. byte array4;
If each array has been initialized, which statement will cause a compiler error?
A. Array2 = array1;
B. Array2 = array3;
C. Array2 = array4;
D. Both A and B
E. Both A and C
F. Both B and C
Answer: F
Question No 30
Exhibit:
1. class super (
2. public int I = 0;
3.
4. public super (string text) (
5. I = 1
6. )
7. )
8.
9. public class sub extends super (
10. public sub (string text) (
11. i= 2
12. )
13.
14. public static void main (straing args) (
15. sub sub = new sub (“Hello”);
16. system.out. PrintIn(sub.i);
17. )
18. )
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: A
Java认证
下一篇:SCJP认证历年经典考题(8)
上一篇:SCJP认证历年经典考题(6)