Hi

which aproach better and why ?extending Thread or Implements Runnable
[83 byte] By [Mritunjay0506a] at [2007-11-27 7:02:25]
# 1
What for? Extending Thread or creating something that can be run by one?
CeciNEstPasUnProgrammeura at 2007-7-12 18:53:25 > top of Java-index,Java Essentials,Java Programming...
# 2
> which aproach better and why ?> extending Thread or Implements Runnableboth
achyuthba at 2007-7-12 18:53:25 > top of Java-index,Java Essentials,Java Programming...
# 3
> > which aproach better and why ?> > extending Thread or Implements Runnable> > bothThis is some sort of joke right?Okay. Ha ha ha ha ha ha. Funny guy.
cotton.ma at 2007-7-12 18:53:25 > top of Java-index,Java Essentials,Java Programming...
# 4

Mritunjay0506,

Please in future try and use thread titles that have some meaning or relevence to your question. "Hi" is a very shitty subject line.

As far as your questions goes: 99.9% of the time it is better to use Runnable. The person who said both was either joking or does not know what they are talking about.

Also please look around the forums next time, this question has been asked and answered repeatedly. Further this question is the #1 FAQ on the Concurrency FAQ page.

http://forum.java.sun.com/ann.jspa?annID=9

cotton.ma at 2007-7-12 18:53:25 > top of Java-index,Java Essentials,Java Programming...
# 5

> which aproach better and why ?

> extending Thread or Implements Runnable

In my understanding, to keep a pure OO understanding of things, you should extend Thread only if you're creating a new type of Thread with nifty new behavior that adds some useful functionality to the Thread class.

For almost all other cases, you should implement Runnable.

kevjavaa at 2007-7-12 18:53:25 > top of Java-index,Java Essentials,Java Programming...