This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Extending Thread over Implementing Runnable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Extending Thread over Implementing Runnable" Watch "Extending Thread over Implementing Runnable" New topic
Author

Extending Thread over Implementing Runnable

Udaya Wijenayake
Ranch Hand

Joined: May 15, 2009
Posts: 30
What are the advantages of extending thread class over implementing runnable interface? If there are no advantages then why there is a thread class?


SCJP 1.5
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

both are same as thread class itself implements the runnable interface.
you can choose any one from them.but extending a class will always consider a bad programming practice


SCJP6.0,My blog Ranchers from Delhi
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
See ExtendingThreadVsImplementingRunnable
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Extending Thread over Implementing Runnable
 
Similar Threads
best way to create a thread
threads
Multithreading
Runnable Interface VS Thread Class
Extending Thread or implementing Runnable