it actually throws InterruptedException and not IllegalStateException and you need to handle in the run method.
The Zen of Java Programming.
Joined: Feb 28, 2007
It is InterruptedException!
"Previous post edited"
Joined: Jun 13, 2007
Thank you Chandra and Pravin. Regarding the question, this is from Kathy & Bert, Master Exam. If I enclose 'other.join' in try-catch block (handle InturreptedException), code would compile fine. As explained in the answer key, I did not understand the meaning of 'attempts to join two threads' as there are only two threads. Other two similar program solution say, one thread join after other. SO wanted to know if I'm missing something here.
I wonder the # of posts answered everyday in this website. I'm very new to Java and Ranch. Like to start my career in Java, starting with SCJP certification. Hope one day I get to answer others quiries.