http://blog.csdn.net/ssssssue
Join
public class Demo01 {
public static void main(String[] args) {
JRunnable jRunnable = new JRunnable();
Thread t1 = new Thread(jRunnable);
t1.start();
try {
t1.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
for (int i = 0; i < 20; i++) {
System.out.println(Thread.currentThread().getName() + i);
}
System.out.println("主线程结束");
}
}
class JRunnable implements Runnable{
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(Thread.currentThread().getName() + i);
}
}
}
Day.30