package com.Java;

//Join 线程插队 必须执行完再执行其他线程
public class TestJoin implements Runnable {
@Override
public void run() {
for (int i = 0; i < 500; i++) {
System.out.println("我是vip" + i);
}
}

public static void main(String[] args) throws InterruptedException {
TestJoin tj = new TestJoin();
Thread thread = new Thread(tj);
thread.start();
for (int i = 0; i < 1000; i++) {
if (i == 300) {
thread.join();//插队 必须执行完
}
System.out.println("主线程" + i);
}

}
}