Java / Java Concurrency and Multi Threading in Java 17 and Java 21 Interview questions
What happens when you call start() twice on the same thread?
Calling start() a second time on the same Thread instance, whether it's still running or already finished, throws IllegalThreadStateException.
Thread t = new Thread(() -> doWork()); t.start(); t.start(); // throws IllegalThreadStateException
This is because a Thread object's lifecycle is one-directional: once it moves out of the NEW state, it can never go back, even after reaching TERMINATED. There is no built-in way to "restart" a finished thread object.
If you need to run the same logic again, you create a brand-new Thread (or submit the task again to an ExecutorService, or start a fresh virtual thread), rather than trying to reuse the same instance. This is one reason task logic is usually written as a reusable Runnable or Callable, separate from the disposable Thread that runs it once.
More Related questions...