I was reading about threads and found that we can’t call the start method twice on the same thread instance. But I didn’t understand the exact reason for the same. So why can’t we call it twice or even more times?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In my opinion the Thread object is your “handle” for the actual running context. If you allow creating many concurrent executions associated with the same java.lang.Thread, what would you expect getStackTrace() and getState() methods to return?
I suppose that Thread class could have been designed to allow spawning multiple running contexts, but its API would be less simple and clean.