)92-147/147的文章 name=description>


SCJP考试题310-025(第二套<4>)92-147/147
来源:优易学  2011-9-22 20:30:08   【优易学:中国教育考试门户网】   资料下载   IT书店

QUESTION NO 140
Which two demonstrate encapsulation of data? (Choose Two)
A. Member data have no access modifiers.
B. Member data can be modified directly.
C. The access modifier for methods is protected.
D. The access modifier to member data is private.
E. Methods provide for access and modification of data.
Answer: D, E
QUESTION NO 141
Exhibit:
1. class A {
2. public String toString () {
3. return “4”;
4. }
5. }
6. class B extends A {
7. 8. public String toString () {
8. return super.toString() + “3”;
9. }
10. }
11. public class Test {
12. public static void main(String[]args) {
13. System.out.printIn(new B());
14. }
15. }
What is the result?
A. Compilation succeeds and 4 is printed.
B. Compilation succeeds and 43 is printed.
C. An error on line 9 causes compilation to fail.
D. An error on line 14 causes compilation to fail.
E. Compilation succeeds but an exception is thrown at line 9.
Answer: B
QUESTION NO 142
Which two statements are true? (Choose Two)
A. An anonymous inner class can be declared inside of a method
B. An anonymous inner class constructor can take arguments in some situation.
C. An anonymous inner class that is a direct subclass that is a direct subclass of Object can implement
multiple interfaces.
D. Even if a class Super does not implement any interfaces, it is still possible to define an anonymous
inner class that is an immediate subclass of Super that implements a single interface.
E. Event if a class Super does not implement any interfaces, it is still possible to define an anonymous
inner class that is an immediate subclass of Super that implements multiple interfaces.
Answer: A, B
QUESTION NO 143
Given:
1. public class MethodOver {
2. private int x, y;
3. private float z;
4. public void setVar(int a, int b, float c){
5. x = a;
6. y = b;
7. z = c;
8. }
9. }
Which two overload the setVar method? (Choose Two)
A. void setVar (int a, int b, float c){
x = a;
y = b;
z = c;
}
B. public void setVar(int a, float c, int b) {
setVar(a, b, c);
}
C. public void setVar(int a, float c, int b) {
this(a, b, c);
}
D. public void setVar(int a, float b){
x = a;
z = b;
}
E. public void setVar(int ax, int by, float cz) {
x = ax;
y = by;
z = cz;
}
Answer: B, D
QUESTION NO 144
Which statements about static inner classes are true? (Choose Two)
A. A static inner class requires a static initializer.
B. A static inner class requires an instance of the enclosing class.
C. A static inner class has no reference to an instance of the enclosing class.
D. A static inner class has access to the non-static members of the outer class.
E. Static members of a static inner class can be referenced using the class name of the static inner
class.
Answer: C, E
QUESTION NO 145
Given:
1. public class X {
2. public object m () {
3. object o = new float (3.14F);
4. object [] oa = new object [1];
5. oa[0]= o;
6. o = null;
7. oa[0] = null;
9. return o;
9. }
10. }
When is the float object created in line 3, eligible for garbage collection?
A. Just after line 5.
B. Just after line 6.
C. Just after line 7.
D. Just after line 8(that is, as the method returns).
Answer: C
QUESTION NO 146
Which two interfaces provide the capability to store objects using a key-value pair? (Choose Two)
A. Java.util.Map.
B. Java.util.Set.
C. Java.util.List.
D. Java.util.StoredSet.
E. Java.util.StoredMap.
F. Java.util.Collection.
Answer: A, E
QUESTION NO 147
Which interface does java.util.Hashable implement?
A. Java.util.Map.
B. Java.util.List.
C. Java.util.Hashable.
D. Java.util.Collection.
Answer: A

上一页  [1] [2] [3] [4] [5] [6] [7] [8] 

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训