Is it legal to call the start method twice on the same Thread?

From the Java API Specification for the Thread.start method:

It is never legal to start a thread
more than once. In particular, a
thread may not be restarted once it
has completed execution.

Furthermore:

Throws:
IllegalThreadStateException – if the thread was already started.

So yes, a Thread can only be started once.

If so than what do I do if I want to
run the thread again?

If a Thread needs to be run more than once, then one should make an new instance of the Thread and call start on it.

Leave a Comment