当前位置:SCJP程序员认证考试题库

问题:

[单选]

public class SyncTest { 
private int x;  
private int y;  
public synchronized void setX (int i) (x=1;)  
public synchronized void setY (int i) (y=1;)  
public synchronized void setXY(int 1)(set X(i); setY(i);)  
public synchronized Boolean check() (return x !=y;)  
}  
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.

区域试验主要对品种的什么特性进行鉴定? 工程总承包合同中属于发包人义务的是()。 提供履约保证。 负责工程的协调。 提供现场。 终止合同。 案件的鉴定人如果在诉讼开始之前就知道案件情况的,优先作为证人参加诉讼。 钢筋混凝土房屋应根据()、()和高度采用不同的抗震等级,并应符合相应的计算和构造措施要求。 将两种不同倾向的教育活动有机地结合成一体,其要点是处理好()和()的关系,过程和()的关系,()要求与儿童需要、()的关系。

public class SyncTest { 
private int x;  
private int y;  
public synchronized void setX (int i) (x=1;)  
public synchronized void setY (int i) (y=1;)  
public synchronized void setXY(int 1)(set X(i); setY(i);)  
public synchronized Boolean check() (return x !=y;)  
}  
Under which conditions will check () return true when called from a different class? 

参考答案:

  参考解析

本题暂无解析

在线 客服