aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Stopping Thread From Execution 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 "Stopping Thread From Execution" Watch "Stopping Thread From Execution" New topic
Author

Stopping Thread From Execution

Sahul Yasin
Ranch Hand

Joined: Aug 28, 2002
Posts: 48
Hi ,
What can cause a thread to stop executing?
1) The program exits via a call to System.exit(0);
2) Another thread is given a higher priority
3) A call to the wait() method.
4) A call to the thread's join() method.
5) A call to the thread's sleep() method.
6) Power off the PC
7) All of the above


Regards,<br />Yasin<br />SCJP,SCWCD,SCBCD
Jonathan Oblea
Greenhorn

Joined: Jul 29, 2002
Posts: 20
Hello,
I think the answer is 7) All of the above.
Because the question is "what CAN cause" and all of the options
are possible reasons why a thread can stop its execution.
Regards,
Sahul Yasin
Ranch Hand

Joined: Aug 28, 2002
Posts: 48
Hi Jonathan,
Can join() method able to stop the thread of execution?.
I confused little in this.
Jonathan Oblea
Greenhorn

Joined: Jul 29, 2002
Posts: 20
Hello,
Yes, a call to join() is guaranteed to cause the current thread to stop executing until the thread it joins with completes.
Regards,
Sahul Yasin
Ranch Hand

Joined: Aug 28, 2002
Posts: 48
Thanks Jonathan,I read once again K&B threading chapter and clear now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stopping Thread From Execution