The following code leads to "java.lang.IllegalThreadStateException: Thread already started." the second time it is run through on the program.
It is never legal to start a thread more than once. In particular, a thread may not be restarted once it has completed execution.
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?
Thread needs to be run more than once, then one should make an new instance of the
Thread and call
start on it.