Interview Questions

Can you again start Thread?

Java Interview Questions and Answers (part 4)


(Continued from previous question...)

12. Can you again start Thread?

No, we cannot start Thread again, doing so will throw runtimeException java.lang.IllegalThreadStateException. The reason is once run() method is executed by Thread, it goes into dead state.
Let’s take an example-
Thinking of starting thread again and calling start() method on it (which internally is going to call run() method) for us is some what like asking dead man to wake up and run. As, after completing his life person goes to dead state.

(Continued on next question...)

Other Interview Questions