jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread.yield() method - where do we call it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread.yield() method - where do we call it" Watch "Thread.yield() method - where do we call it" New topic

Thread.yield() method - where do we call it

Charles Chikito
Ranch Hand

Joined: May 22, 2009
Posts: 76
Hello there,

Just wondering where we should call the yield() method.

In main() or run() ?

I guess in run(), correct me if I'm wrong.


Henry Wong

Joined: Sep 28, 2004
Posts: 18546

The thread that you want to yield should call the Thread.yield() method.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Deepak Bala

Joined: Feb 24, 2006
Posts: 6661

It depends on which thread you want to yield(). Place the appropriate call there

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
I agree. Here's the link: http://aspose.com/file-tools
subject: Thread.yield() method - where do we call it
Similar Threads
Difference between run and start method of Thread
Why start() method
regarding thread run method