The Thread that calls the join method of another Thread waits for the other Thread to die before proceeding.
publicclass MainClass implements Runnable {
publicstaticvoid main(String[] args) {
MainClass jt = new MainClass();
try {
jt.t.join();
System.out.println("after join");
} catch (InterruptedException ex) {
System.out.println("main exception:" + ex);
}
}
Thread t;
public MainClass() {
t = new Thread(this);
t.setPriority(Thread.MIN_PRIORITY);
t.start();
}
publicvoid run() {
;
}
}