File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes   about thread and Runnable interface 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 "  about thread and Runnable interface" Watch "  about thread and Runnable interface" New topic
Author

about thread and Runnable interface

sujit kanase
Greenhorn

Joined: May 26, 2005
Posts: 2
does Runnable implements Thread Class
and which is better to use thread or Runnable and why?
srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252
sujit

Thread class implements the Runnable interface ...

As far as second question i dont think there is any problem in using either ..anyone is OK ....

thanks

srikanth


Thanks & Regards<br /> <br />-Srikanth
Sandeep Chhabra
Ranch Hand

Joined: Aug 28, 2005
Posts: 340
See if your class extends some other class...and you need introduce concurrency in your class then you might be tempted to implement the Runnable Interface.
Otherwise you always have the option to extend Thread Class.


Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Shweta Dhaneshwar
Greenhorn

Joined: May 02, 2005
Posts: 1
does Runnable implements Thread Class
and which is better to use thread or Runnable and why?


for you 1st question the ans is a class can implement a interface or can extend a class.An interface can extend an interface.So the Runnable interface does not implement Thread Class.

I think we should use Runnable interface coz if your class extends Thread class...then you cannot extend another class(multiple inheritance not allowed in java)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about thread and Runnable interface