试题详情
- 单项选择题 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 setseparately.
- B
关注下方微信公众号,在线模考后查看
热门试题
- 在java中,下列标识符不合法的有()。
- 下列有关UML类图的描述,错误的是哪项?
- 输入某年某月某日,判断这一天是这一年的第
- 猴子吃桃问题:猴子第一天摘下若干个桃子,
- 现有: class&ens
- 将7723810的各位数字打乱排序,可组
- class Sock2&en
- Given: ArrayL
- public class&e
- A developer
- A developer&en
- 现有: class&ens
- 下述说法中抽象类与接口的区别正确的有哪些
- Under which
- 31. // so
- 利用线程方法编写JApplet程序,实现
- 程序中实现多线程的方法有两种:继承Thr
- Which statemen
- 下列哪项不是int类型的字面量?()
- What is th