• Post Reply Bookmark Topic Watch Topic
  • New Topic

Different of 'extends Thread' and 'implements Runnable'?

 
Aji Prasetyo
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I have a doubt on the different of 'extends Thread' and 'implements Runnable'.
When should I use extends thread and when should I use implements Runnable?

Thank you.
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the benefits of an extending from Thread is that you can
customized the lifecycle.

e.g. you can override the interrupt() method to close open resources before
propagating the actual request for interruption.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a writeup on this topic in the FAQ: ExtendingThreadVsImplementingRunnable
 
Aji Prasetyo
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Thank you for the insight and I will study the FAQ.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!