线程执行过程中添加新线程
package com.aaa.thread.Test;
public class TestTwo implements Runnable {
@Override
public void run() {
for (int i=0;i<10;i++){
System.out.println(Thread.currentThread().getName() + "\t" + i);
}
}
public static void main(String[] args) throws InterruptedException {
TestTwo testTwo = new TestTwo();
Thread t = new Thread(testTwo,"One");
t.start();
for (int i=1;i<11;i++){
System.out.println(Thread.currentThread().getName());
if (i==3){
t.join();
}
}
}
}

浙公网安备 33010602011771号