This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
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

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

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.
Have you tried LearnNowOnline?
subject: Thread vs Runnable