Why Runnable interface is preferable than extending the Thread class - Java

Why Runnable interface is preferable than extending the Thread class?

- Runnable interface is always preferred because, the class implementing it can implement as many interfaces as a developer can, and also extend another class.

- Whereas extending the Thread class, it can not extend another class, as Java supports only single inheritance.

- A thread class can be extended but then any other class cannot be extended.

- If a runnable interface is used the class can be extended which is required other than the thread class.

- The main reason to run an runnable interface is because Java does not support multiple inheritance.
Difference between a java object reference and c++ pointer
The prime difference is that pointers are to locate the address of the primitive variables only...
What is JasperReports?
Jasper Report is a very popular open source reporting tool written in Java. The reports can be seen on the screen, on a printer...
Spring framework vs. Struts framework
Struts: Struts is a MVC pattern framework, Generating integration logic is done dynamically using Struts...
Post your comment