移动端

  • 题王微信公众号

    题王微信公众号

    微信搜“题王网”真题密题、最新资讯、考试攻略、轻松拿下考试

单选题

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?   

发布日期:2021-08-12

public class SyncTest (  private int x;  private i...
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 setseparately.

标签: "暂无标签"

题王网让考试变得更简单

扫码关注题王,更多免费功能准备上线!