In java, does run() register a thread in a thread scheduler?
What about construct(),start() and register() ?
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.
No. If you call the
run()method directly, it is called as a normal method; i.e. it runs on the current thread, not a new one.The
startmethod creates a new thread, and in the process the thread will be registered with the scheduler. (However, the scheduler is a nebulous concept in Java. It is implied that one must exist, but its implementation and behavior are typically left to the host operating system. A pure Java program has almost no control over the way that the thread scheduler actually works.)There are no
construct()orregister()methods in theThreadAPI. If you are referring to theThreadconstructors, they only create aThreadobject, and NOT the underlying thread that will do the work. The latter is only created whenstart()is called.