SCJP考试题310-025(第二套)92-147/147

来源:java认证发布时间:2012-11-12 13:05:41java认证视频


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

上一页678下一页

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答