当前位置: 技术问答>java相关
SCJP题 about Thread
来源: 互联网 发布时间:2015-03-18
本文导语: 2. Assume you are writing a piece of code in which two variables, x and y, should maintain a particular relationship. You want to protect the relationship against damage due to concurrent access by multiple threads. Which statements are correct? A...
2. Assume you are writing a piece of code in which two variables, x and y, should maintain a particular relationship. You want to protect the relationship against damage due to concurrent access by multiple threads. Which statements are correct?
A. The variables should be marked protected
B. The variables should be marked private
C. The variables can have any accessbility
D. All methods of the class must be synchronized
E. All methods that have access to the variables must be synchronized
我个人认为选B D
你们说选什么?
A. The variables should be marked protected
B. The variables should be marked private
C. The variables can have any accessbility
D. All methods of the class must be synchronized
E. All methods that have access to the variables must be synchronized
我个人认为选B D
你们说选什么?
|
E 也对