日期:2014-05-18  浏览次数:20680 次

线程同步的
package util;

public class B {
static class C {
static int i = 1;
public C(){
Thread thread1 = new Thread("a") {
public void run() {
for (;;) {
C.run();
}
}
};
Thread thread2 = new Thread("c") {
public void run() {
for (;;) {
C.run();
}
}
};
thread1.start();
thread2.start();
}
public synchronized static void run() {
{
System.out.println("i = " + i+Thread.currentThread().getName());
i++;
}
}
}
public static void main(String[] args) throws Exception {
new C();
}
}
多线程 java

------解决方案--------------------
你贴个代码出来.谁干什么啊?同步???
------解决方案--------------------
LZ想表达什么意思呢?
------解决方案--------------------
哈哈,楼主两位不要这样吗,会吓到楼主得