0

I have searched quite a bit on a reason to use extend thread instead of runnable and have found very little. Anyone have a good reason for someone who is just learning Java.

niallo27
  • 215
  • 1
  • 2
  • 8
  • `I have searched quite a bit` Did you ? – Dici Oct 06 '15 at 21:36
  • Yes i did search here and the answer was always they didnt see any reason to extend thread – niallo27 Oct 06 '15 at 21:39
  • In the post we marked as duplicates you have some answers. The accepted answer does not extend a lot on the question but you have interesting things in the comments too – Dici Oct 06 '15 at 21:42
  • I understand there is a lot of info in that answer but very little if anything on why to use extend. Would you agree or maybe i am not looking hard enough. That question tells me the differences between both and why not to use extends thread. – niallo27 Oct 06 '15 at 21:46
  • The answers let you see that there is no real advantage to extending `Thread`.In a very simple case, it saves you writing `Runnable` in your code, in all other cases implementing `Runnable` is nicer. – Dici Oct 06 '15 at 21:56
  • When do you need to extend a class? The answer is when you want to specialize the class' behavior. If you're not actually trying to specialize the behavior of Thread, then there is no good reason to extend it. If you're trying to use the behavior of Thread, then use the interface Runnable. – hooknc Oct 06 '15 at 22:14

0 Answers0