A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCM Java EE 6 Enterprise Architect Exam Guide
this week in the
Programmer Certification (SCJP/OCPJP)
q on threads
Joined: Sep 27, 2004
Dec 08, 2004 02:47:00
You have an application that executes the following line:
Thread myT = new Thread();
Which statements are correct? [Check all correct answers]
The Thread myT is now in a runnable state.
The Thread myT has the priority of the Thread that executed the construction statement.
If myT.start() is called, the run method in the class where the construction statement appears will be executed.
If myT.stop() is called, the Thread can later be started with myT.start() and will execute the run method in the Thread class.
which are the correct options and y?
SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Joined: Sep 15, 2004
Dec 08, 2004 07:08:00
Hi Jayasiji Gopal,
I feel only the second statement is correct as, a thread inherits the priority of the parent thread.
First is false because, only when a myT.start() is called a thread enters the Runnable state. Till then, it is just a live object.
Third is false because the default "run" of the Thread class will be called.
Fourth, I am not very sure, but since stop() is deprecated, you will not get questions pertaining to stop in your SCJP1.4.
Expecting answers and demures. Thanks!
Last but not the least! As always pointed out by Barry, please always mention the link from which you get the question that you publish for us.
Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
I agree. Here's the link:
subject: q on threads
thread question from java cram
Thread Question on Exam Cram Mock
ExamCram - Threads
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014