谁能解释这段代码:
public class Main implements Runnable{
private int i;
public synchronized void run() {
System.out.print("i = "+ i +"\n");
if (i % 5 != 0) {
i++;
}
for (int x = 0; x < 5; x++, i++) {
if (x > 1) {
Thread.yield();
}
}
}
public static void main(String[] args) {
Main n = new Main();
for (int x = 100; x > 0; --x) {
new Thread(n).start();
}
}
}
以及输出如何
i= 0
i= 5
i= 10
i= 15
i= 20
.
.
.
i= 499