This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes thread question from java cram Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "thread question from java cram" Watch "thread question from java cram" New topic
Author

thread question from java cram

may leung
Greenhorn

Joined: Nov 28, 2000
Posts: 23
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
Michael Burke
Ranch Hand

Joined: Jul 29, 2000
Posts: 103
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thread question from java cram