最简单的join方法
public class Test {
public static void main(String[] args) throws InterruptedException{
for(int i = 0; i < 50; i ++){
Thread threadA = new Thread(new Runnable() {
@Override
public void run() {
System.out.print("A");
}
});
threadA.start();
threadA.join(0);
Thread threadB = new Thread(new Runnable() {
@Override
public void run() {
System.out.print("B");
}
});
threadB.start();
threadB.join(0);
}
}
}
https://blog.51cto.com/u_13544/6425126
标签:ABAB,join,threadB,Thread,void,打印,交替,new,public From: https://www.cnblogs.com/chenyi502/p/17832085.html