This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Yield method 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 "Yield method" Watch "Yield method" New topic
Author

Yield method

kumar bangali
Greenhorn

Joined: Dec 01, 2001
Posts: 27
Hi
Please consider this piece of code
class Testthread2 extends Thread
{
public void run()
{
System.out.println("starting");
yield();
System.out.println("done");
}
}
public static void main(String args[])
{
Testthread2 tt = new Testthread2;
tt.start;
}
In this example should the yield method not be in a try catch block since the thread gets interrupted by yield?


Bos Indicus
Jim Hall
Ranch Hand

Joined: Nov 29, 2001
Posts: 162
The yield() method does not throw an exception, so therefore it needn't be in a try block.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Yield method
 
Similar Threads
Thread :RHE Pg 230
yield() and run()
Why doesn't this Multithreading program work?
yield();
yield()