File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "q on threads" Watch "q on threads" New topic

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%)
I agree. Here's the link:
subject: q on threads
It's not a secret anymore!