废话不多说,代码走起
package com.zhku.thread;
public class TestThread {
//阻塞
public synchronized static void test() throws InterruptedException {
for (int i=0; i<100; i++) {
Thread.sleep(1000);
System.out.println(i);
}
}
//阻塞
public static void test1() throws InterruptedException {
synchronized (TestT