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 R & H Doubts 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 "R & H Doubts" Watch "R & H Doubts" New topic
Author

R & H Doubts

Shachi Singh
Greenhorn

Joined: Apr 05, 2007
Posts: 13
can anyone explain me the difference b/w Runnable's run() and Threads Run()
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
Wecome to Javaranch..
To search the answer of the question lets start with the Runnable interface.It contains only one method names

Thread class itself implements Runnable interface and hence implements the run method.


~Sanjeev Singh<br />SCJP 1.5
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

The API documentation is an ideal resource to answer questions like this.

First, note that Runnable is an interface. Looking at Runnable's run method (which is its only method), we see that...
When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

Next, note that Thread is a class that implements Runnable. Looking at Thread's run method, we see that...
If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Shachi Singh
Greenhorn

Joined: Apr 05, 2007
Posts: 13
Thanks a lot Marc!
Shachi Singh
Greenhorn

Joined: Apr 05, 2007
Posts: 13
Thanks Sanjeev
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: R & H Doubts