如下代码为什么不会输出线程1中的打印部分?线程在start后执行具体代码前是不是会判断线程是否调用了join方法?我想知道的是在多线程执行过程中某一线程开启后,若该线程调用了join方法(不论在何位置调用)就等同于为开启该线程而是直接调用该线程类中的run方法呢?
public class TestMain { /**
 * @param args
 * @throws InterruptedException 
 */
public static void main(String[] args) {
System.out.println("主线程开始执行");
try {
ThreadTest1 test1 = new ThreadTest1();
Thread t1 = new Thread(test1);
t1.start();
for(int i=0;i<1000;i++){
System.out.println("我是主线程");
}
t1.join();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("主线程执行完毕");
}}public class ThreadTest1 implements Runnable { @Override
public void run() {
for(int i=0; i<1000; i++){
System.out.println("我是线程1--" + i);
}
}}