It's not a secret anymore!
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
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: 20525

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)
I agree. Here's the link:
subject: Thread Doubt
It's not a secret anymore!