You have an application that executes the following line: Thread myT = new Thread(); Select all of the following statements that are correct. [Check all correct anwers] A) The Thread myT is now in a runnable state. B) The Thread myT has the priority of the Thread that executed the construction statement. C) If myT.start() is called, the run method in the class where the construction statement appears will be executed. D) If myT.stop() is called, the Thread can later be started with myT.start() and will execute the run method in the Thread class.
The ans is B. I am not very understand what it said in B and C! can anyone explain to me? Thanks in advance and happy new year
posted 15 years ago
Ans. B seems pretty clear. If you don't assign a priority to a thread it inherits the prority of the thread that created it, in this case the program thread ( I guess). Ans. C is looking to see if you can distinguish between programs that use Runnable and those that use the Thread class to perform multi-threading. Since the thread constructor in this case doesn't take any arguments the new thread is using the run method of the thread class, if the new thread had been constructed with an object of the class in which it had been created and that class implented the Runnable interface, ques. B would have been a correct ans.