java – What is the difference between Thread and Runnable?

Question:

What is the difference between Thread and Thread (Runnable)?

In other words, what is the benefit of the Thread being implemented through the Runnable interface? This is like a stream in a stream or some extra. functions will be? For example, access to the UI? ..

Answer:

  1. Multithreading in JAVA is by no means limited to the Thread class
  2. In the context of a specific task, it may be more beneficial to inherit from some other class, but multiple inheritance in JAVA is not supported, exit: implements Runnable
  3. The Runnable interface is mediocre to threads – it should be regarded as a passable function that can be executed elsewhere (thread, queue, class, method, etc.)
Scroll to Top