aspose file tools*
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
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