File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Yield method

kumar bangali

Joined: Dec 01, 2001
Posts: 27
Please consider this piece of code
class Testthread2 extends Thread
public void run()
public static void main(String args[])
Testthread2 tt = new Testthread2;
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:
subject: Yield method
It's not a secret anymore!