1
Каким будет вывод следующей программы?
class Test implements Runnable {
private int x;
public static void main(String[] args) {
Test test = new Test();
new Thread(test).start();
new Thread(test).start();
}
public synchronized void run() {
for (int i = 0; i < 3; i++) {
System.out.println("x = " + ++x);
}
}
}
Please log in or register to have a possibility to add comment.