Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt with join() method

 
Gitesh Ramchandani
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source: Dan Chisholm

Which of the following are true statements?

a. The Thread.join method is static
b. The Thread.join method is always invoked on an instance of Thread
c. The Thread.join method causes the current thread to wait for the referenced thread to die
d. The Thread.join method declares an InterruptedException in the throws clause
e. The Thread.join method accepts a timeout value as an argument
f. The timeout value sets the minimum time that the current thread will wait for the death of the referenced thread
g. Thread.join will return immediately if the timeout value is zero
h. A timeout of zero will allow Thread.join to wait forever if necessary

Ans: b,c,d,e,h
Doubt: why is option f wrong?

Thanks,
Gitesh
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The description in the API of the join :
Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever.


Regards,
Alex
 
Gitesh Ramchandani
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so is this correct then:

The timeout value sets the minimum time that the current thread will wait for the death of the referenced thread


Gitesh :roll:
 
Dean Jones
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please explain me the meaning of the following statement in regard to join method.

A timeout of 0 means to wait forever.
Thanks in advance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic