public class X implements Runnable {
private int x;
private int y;
public static void main(String[] args) {
X that = new X();
(new Thread(that)).start();
(new Thread(that)).start();
}
public synchronized void run() {
for (;;) {
x++;
y++;
System.out.println("x=" + x + ",y=" + y);
}
}
}
为什么输出的值相等,并且只出现一次

博客围绕输出值相等且仅出现一次的现象展开,提出为何会出现这种情况的疑问,聚焦于信息技术领域中输出值的相关特性。
3983

被折叠的 条评论
为什么被折叠?



