This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Doubt" Watch "Thread Doubt" New topic

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
Henry Wong

Joined: Sep 28, 2004
Posts: 18509

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.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
wood burning stoves
subject: Thread Doubt
Similar Threads
Doubt in Threads
doubt in wait() method.......
another thread doubt
Doubt on wait method in Threads