aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Q from jexam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Q from jexam" Watch "Thread Q from jexam" New topic
Author

Thread Q from jexam

anil bisht
Ranch Hand

Joined: Nov 04, 2000
Posts: 81
Which of the following will definitely stop a thread from executing:
wait()
notify()
yield()
suspend()
sleep()
the answer given is a,c,d,e
but how come c. if there is no other thread then it wont stop the thread .. and the resoning given was

Only notify() will not explicitly stop an executing thread from running. Yield() returns control back to the JVM, which may or may not stop the thread from running.

( so its no definite )
if the Q was whcih of the following can stop the thread then yield() is one of the answer ..
correct me if i am wrong ..
anil
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
I tend to agree with you anil, but I think what they are saying, is that yield() will stop the thread and move it into the ready state, and then if no other threads can start then it will be put back into the running state. So basically it does stop it for a while. But I don't like the question much.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Q from jexam