Explain the difference in using runnable and extends in Thread. We can use Extend Thread class only when the class is not extending another class as Java doesn’t support multiple inheritances. In that case, we can use Runnable interface to create Thread.
When we extend a thread, each thread has a unique object associated with it, whereas with Runnable, many threads share the same object instance.
|