aspose file tools*
The moose likes Threads and Synchronization and the fly likes Runnable Interface VS Thread Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Runnable Interface VS Thread Class" Watch "Runnable Interface VS Thread Class" New topic
Author

Runnable Interface VS Thread Class

rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Hi,

I heard that implementing Runnable Interface is more advantageous when compare to extending Thread class, can any one please explain the advantages and disadvantages of these both.

thanks,
rakesh.


thanks & regards, Rakesh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Welcome to JavaRanch.

There's a lengthy writeup in the FAQ: ExtendingThreadVsImplementingRunnable


Ping & DNS - updated with new look and Ping home screen widget
rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Thank You for a quick response.
rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
But i heard that if you want make use of all thread methods then go for extending Thread class else if you want to implement only run() method then use Runnable interface. How far this is true.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
It is true, but that doesn't contradict what the FAQ entry says.
rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Thank You
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runnable Interface VS Thread Class
 
Similar Threads
run method
why does java have a thread class and a Runnable interface??
Thread/ Runnable
Passing this to a constructor
Extending Thread or implementing Runnable