t.join();表示当前线程停止执行直到t线程运行完毕;
t.join(1000); 表示当前线程等待t线程运行1000后执行;
/*
* Test.java
*
* Created on 2008年2月25日, 上午9:57
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author rulinma
*/
public class Test {
/** Creates a new instance of Test */
public Test() {
}
//Display a message, preceded by the name of the current thread
static void threadMessage(String message) {
String threadName = Thread.currentThread().getName();
System.out.format("%s: %s%n", threadName, message);
}