线程状态--强制执行
package state;
public class TestJoin implements Runnable{
@Override
public void run() {
for (int i = 0; i < 1000; i++) {
System.out.println("vip线程"+i++);
}
}
public static void main(String[] args) throws InterruptedException {
TestJoin testJoin = new TestJoin();
Thread thread = new Thread(testJoin);
thread.start();
for (int i = 0; i < 500; i++) {
if(i==100){
thread.join();
}
System.out.println("main线程"+i++);
}
}
}

浙公网安备 33010602011771号