File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Doubt" Watch "Thread Doubt" New topic
Author

Thread Doubt

Gitesh Ramchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 274
Which two can directly cause a thread to stop executing? (Choose Two)
A. Exiting from a synchronized block.
B. Calling the wait method on an object.
C. Calling the notify method on an object.
D. Calling the notifyAll method on an object.
E. Calling the setPriority method on a thread object.

Ans: B,E

Doubt �How E is a valid answer?

pls help
regards,
gitesh
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18757
    
  40

Originally posted by Gitesh Ramchandani:
Doubt �How E is a valid answer?


Schedulling is preemptive (for all but the oldest JVMs). If you raise a thread to a priority that is higher than the current thread, you can cause the current thread to block.

And please Quote Your Sources.

Thanks,
Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Doubt