Click here to Skip to main content
15,905,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,


can you please tell me which method is better in thread (java ). example
1) implement thread
2) class thread thread .

?
and why please explain?
Posted

Hi Ravi,

In may case, I use normally implements the interface instead extends to thread. Why? Because if you implements the interface, you have the possibility to implements others interfaces in your class and extend your class to another one .

If you extend your class to thread class, you loose the possibility to extend our class to another class, that makes more sense than extend to thread.

Take a look on this forum:
http://stackoverflow.com/questions/541487/implements-runnable-vs-extends-thread[^]

Best regards
Filipe
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900