wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes q on threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "q on threads" Watch "q on threads" New topic
Author

q on threads

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
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.
Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
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%)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: q on threads
 
Similar Threads
Thread Question on Exam Cram Mock
ExamCram - Threads
Thread Question
thread question from java cram
exam cram