Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Doubt

 
Gitesh Ramchandani
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21385
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic