multithreading - When should you extend Thread in Java? -


i know basics of multithreading. moreover, referred answer mr. jon skeet "implements runnable" vs. "extends thread".

here said:

you're not specialising thread's behaviour. you're giving run. (so use runnable instead of thread)

so question is:

in scenario 1 specialise thread?

when should extend thread in java?

i appreciate answer examples , codes.

thanks!!

think runnable task execute , thread executor. should extend thread if want add specific behavior executor, like, maybe, controlling lifecycle, modifying state, etc. example of classes derived thread can find in jdk(take here), android sdk (take here).


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -