May 22, 2008

(Java) How to detect the end of a child thread

In a main thread, we could create the child thread to do some work in the same time. But how can we get the return value of a child thread before continue the main thread, we should wait the child thread finish before call the other method.

The solution is join() of Thread, it waits for this thread to die.

ChildThread ct = new ChildThread();

No comments: