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

Please Help Me...For Above Question

 
Thangaraj Selvamani
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


Why option g is not selected....
web page

[ December 18, 2008: Message edited by: Thangaraj Raj ]
[ December 18, 2008: Message edited by: Thangaraj Raj ]
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because is not guarantee when this method return he will run immediately. do not forget: "with thread there is not guarantee".
by cause this point is letter is false With thread us can not say.

 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the issue is that the meaning of the milliseconds argument is:
If the value of the argument is 0, then wait forever (until the other thread dies.) If it is not zero, wait until the other thread dies, or until the timeout value is reached, whichever comes first. The semantics of the argument are arbitrary in that 0 means "wait as long as it takes."
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic