GeeCON Prague 2014*
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: 42030
    
  64
Welcome to JavaRanch.

There's a lengthy writeup in the FAQ: ExtendingThreadVsImplementingRunnable


Ping & DNS - my free Android networking tools app
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: 42030
    
  64
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
 
GeeCON Prague 2014
 
subject: Runnable Interface VS Thread Class