I'm trying to figure out what are the possible benefits of extending a Thread class?
This is part of another question that I am describing: There are two ways to create threads in Java
- extending from class Thread
- implementation of an executable interface
As shown here , there are several advantages to using the runnable interface. My question is, what is the advantage of extending from the Thread class? The only advantage that comes to my mind is that you can go from the Thread class and call it the ThreadExtended class. Then he / she can add more functionality to ThreadExtended (which I donβt know what it can be), and then when he wants to create a thread, instead of propagating from the Thread class, it extends from ThreadExtended.
Are there any advantages to using the Thread class instead of Runnable? Do you know any classes that extend from the Thread class and then ask users to extend from these classes if they want to have multithreading?
public class ThreadExtended extends Thread{
source share