VuTuan Tran wrote:
I think th2 is still alive because I did not invoke t2.join().I am not sure it is right or wrong.
Well, I'm afraid it's wrong. The join() method is used to cause the current thread to wait for the thread (represented by the thread object) to complete. It has no affect on the thread.
It is better now. However, there are 2 things I have to get through.Again from my OP, if i name these threads ( just for convenience )
At line 12, join() method is used to cause the current thread to wait for the thread to complete.
So, I know the thread,for sure, is gonna be "fred", but not sure about current thread and complete
Can you tell me which one is the current thread and what do you mean complete here
In this case, by "current thread", I mean the thread that called the join() method... which is also the thread that created "fred" and "lucy". By "complete", I mean "finished", "done", etc. -- the run() method has completed, and the threads is no longer considered alive.
The current thread is the thread in which that line of code executes. Which in your uncompilable code snippet is very likely the "main' thread (but could be the EDT if the same code is run via any event listener).
There are no new questions, but there may be new answers.