请教两道SCJP的模拟题
是104或者147里的。题目如下:
1.
Given:
1. public class SyncTest {
2. private int x;
3. private int y;
4. public synchronized void setX (int i) (x=1;)
5. public synchronized void setY (int i) (y=1;)
6. public synchronized void setXY(int 1)(set X(i); setY(i);)
7. public synchronized Boolean check() (return x !=y;)
8. )
Under which conditions will check () return true when called from a different class?
A. Check() can never return true.
B. Check() can return true when setXY is called by multiple threads.
C. Check() can return true when multiple threads call setX and setY separately.
D. Check() can only return true if SyncTest is changed to allow x and y to be set separately.
Answer: A
这道题,我觉得A也不对。答案却是A,为什么?是不是答案错了?高手帮忙解释一下!
2.
which two are true to describe an entire encapsulation class?
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
我觉得D不应该对,成员变量不能没有途径访问吧。还是
1.
Given:
1. public class SyncTest {
2. private int x;
3. private int y;
4. public synchronized void setX (int i) (x=1;)
5. public synchronized void setY (int i) (y=1;)
6. public synchronized void setXY(int 1)(set X(i); setY(i);)
7. public synchronized Boolean check() (return x !=y;)
8. )
Under which conditions will check () return true when called from a different class?
A. Check() can never return true.
B. Check() can return true when setXY is called by multiple threads.
C. Check() can return true when multiple threads call setX and setY separately.
D. Check() can only return true if SyncTest is changed to allow x and y to be set separately.
Answer: A
这道题,我觉得A也不对。答案却是A,为什么?是不是答案错了?高手帮忙解释一下!
2.
which two are true to describe an entire encapsulation class?
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
我觉得D不应该对,成员变量不能没有途径访问吧。还是
...全文
相关推荐
SUN SCJP认证模拟题
### 关于SUN SCJP认证及模拟题310-035的知识点解析#### 一、SUN SCJP认证概述SUN SCJP(Sun Certified Programmer for Java)是SUN公司推出的一个针对
java题库+scjp模拟题
这个压缩包文件包含了“java题库”和“scjp模拟题”,是为准备SCJP考试的学习者提供的宝贵资源。
Java程序员认证-SCJP模拟题
同时,模拟题的解答过程也可以帮助考生发现自己的弱点,以便针对性地加强学习。总之,SCJP认证是Java程序员专业素养的初步证明,而SCJP模拟题则是通往这一认证的桥梁。
SCJP(310-055)模拟题
"SCJP(310-055)模拟题是一套帮助考生准备Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0认证考试
SCJP模拟题200道
以上就是SCJP模拟题中涉及的Java语言基础、构造函数、GUI布局、变量命名、字体创建、文件操作和随机访问文件等知识点的详细解释。


