• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread

 
Kaushik Badiyani
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following methods will definetely stop a Thread from running
a) wait
b) notify
c) yeild
d) suspend
e) sleep

What will be the correct answer for above and Will certification test us on depricated methods???
Thanx
Kaushik
 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think a , c, d ,e. The real test will not test on deprecated methods.
Anyone correct me if I am wrong
--Farooq
 
Annie Naqvi
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Well IMO the correct ans are a,d & e.As yeild may stop execution but that is not guaranteed.
I can't say anything abt real exam but will tell you soon after giving mine
Regards,
Annie.
 
Kaushik Badiyani
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhammad are u sure of it beacuse i perfectly agree with Annie
Jane i need to know ur views on this question

 
Adam S-R
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Annnie - yield will only stop thread from running if there is a thread with the same priority waiting to run - cannot yield to lower priority threads AFAIK.
HTH
Adam
 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yield() will definately stop the thread from execution and look for any other thread, if there is any other thread it will execute that thread, but if there is no other thread then the original thread will get executed. Here the thread will STOP, then check for another thread, if couldn't fine, execute the same thread, thats what I think.
Any comments,
--Farooq
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From RHE
A thread that has yielded goes into the Ready state. If any other thread are in the Ready state, then the thread that just yielded might have to wait a while before it gets to execute again. However , if there are no other waiting threads, then the thread that just yielded will continue executing immediately. Note that most schedulers do not stop the yeilding thread from running in favor of a thread of lower priority.
 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry, may be I misleaded you ranchers. I think I have to read the question more carefully, as the question says, "methods that will definetely stop a Thread from running", yield() does not ALWAYS stop the thread .
--Farooq
 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yah Farooq, definitely was the word we were watching....
------------------
azaman
[This message has been edited by Ashik uzzaman (edited August 19, 2001).]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic