File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Thread vs Runnable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread vs Runnable " Watch "Thread vs Runnable " New topic

Thread vs Runnable

vijay kumar
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
Is there any other differences between Implementing Runnable interface and Thread class apart from OO opttion.
Saket Barve
Ranch Hand

Joined: Dec 19, 2002
Posts: 229
Functionality wise, no.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
If you extend Thread, each instance will automatically have a reference in a ThreadGroup - this has some implications for locating instances of your class and other stuff. See the java.lang.ThreadGroup JavaDocs.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
It's been noted many times that it was probably a mistake for Thread to
implement Runnable: it confuses the task with the worker. Since one
almost never overrides Thread methods other than run, keep it simple
and implement Runnable and then use Thread without subclassing:
How bad is it that Thread implements Runnable? At another Java site,
I saw some nasty code where someone tried to "restart" a thread like

There is no emoticon for what I am feeling!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Moving to "Threads and Synchronization."

[Jess in Action][AskingGoodQuestions]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You might be interested in this thread.
I agree. Here's the link:
subject: Thread vs Runnable
It's not a secret anymore!