当前位置:大数据时代的政府治理创新题库

问题:

[单选]

public class SyncTest (  
private int x;  
private int y;  
private synchronized void setX (int i) (x=1;)  
private synchronized void setY (int i) (y=1;)  
public 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;  
private synchronized void setX (int i) (x=1;)  
private synchronized void setY (int i) (y=1;)  
public 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?

参考答案:

  参考解析

本题暂无解析

在线 客服