Which interface or class should a class use or extend to create a new thread in Java?

  • Executor
  • Runnable
  • Thread
  • java.lang
In Java, to create a new thread, a class should implement the Runnable interface. The Runnable interface defines a single abstract method, run(), which should be overridden to provide the code that the new thread will execute. The other options are not used for directly creating a new thread.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *