Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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


Win a copy of The Software Craftsman this week in the Agile forum!
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
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
Welcome to JavaRanch.

There's a lengthy writeup in the FAQ: ExtendingThreadVsImplementingRunnable
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
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
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