difference between extending Thread and implementing Runnable Interface

krishna kishore mellacheruvu venkata
krishna kishore mellacheruvu venkata used Ask the Experts™
on
What is the difference between extending Thread class and implementing Runnable Interface?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mick BarryJava Developer
Top Expert 2010

Commented:
not a lot, one give you a thread subclass, the other gives you a class you can create a thread with.
Almost always better to implement Runnable as it allows you to subclass a different class which you would not be able to do if you had already extended Thread
Extending the Thread class will make your class unable to extend other classes, because of the single inheritence feature in JAVA. However, this will give you a simpler code structure. If you implement runnable, you can gain better object-oriented design and consistency and also avoid the single inheritance problems.

check this here
http://www.jguru.com/faq/view.jsp?EID=42423
http://www.javabeat.net/faqs/threads/interview-questions-faqs-1.php
Thank you very much.
@melchkishore: Thanks a lot for the points :). Glad that i could help
But i feel that you can split the point with Objects as he also gave similar solution.

Thanks again
Mick BarryJava Developer
Top Expert 2010

Commented:
thats fine :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial