多线程-join的使用
public class MyThread implements Runnable {@Overridepublic void run() {for (int i = 0; i < 100; i++) {System.out.println(Thread.currentThread().getName() + "--" + i);}}}
public static void main(String[] args) throws Exception {MyThread mt = new MyThread();Thread t1 = new Thread(mt);t1.start();for (int i = 0; i < 100; i++) {System.out.println(Thread.currentThread().getName() + "--" + i);if (i == 50) {t1.join();//注意join的使用。不是静态方法}}}