1

We can create a thread in Java either by implementing Runnable interface or by extending Thread class and implementing Runnable interface is preferred because multiple inheritance is not supported in case of classes,then why would one go for extending Thread class as it seems that implementing Runnable is more beneficial? Can anybody please tell me some practical application where thread class is extended for the creation of thread.

Thanks in advance for the help.

Tarishi Jain
  • 254
  • 3
  • 13
  • 1
    I don't see any good answer to your question on the "duplicate." The short answer is, There is no good reason to extend `Thread`, but Java has been around for a long time. The "implements runnable" technique is an example of _[delegation](https://en.wikipedia.org/wiki/Delegation_pattern)_, and the advantages of using delegation instead of using inheritance simply were not as well known back when Java was created as they are today. There still are a lot of older examples and tutorials in circulation that show the old-fashioned (extends Thread) way of doing it. – Solomon Slow Jul 15 '18 at 16:14

0 Answers0