The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A question about thread 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 "A question about thread" Watch "A question about thread" New topic

A question about thread

avseq anthoy
Ranch Hand

Joined: Apr 27, 2004
Posts: 106
Thread myThread = new Thread();

A.The thread myThread is now in a runnable state
B.The thread myThread has priority is 5
C.On calling the start() method on myThread,the run method in the Thread class will be execute
D.On calling the start() method on myThread,the run method in the calling class will be execute


why B is wrong?

My Way,My Pace
Anil Hulikal

Joined: Apr 02, 2004
Posts: 29
I think within the context of this question, a thread of execution has not begun; only a Thread object has been created. This object may very well have a field value of priority = 5. However, the wording of the given option is �The thread myThread has priority is 5�. Probably by �thread�, they are referring to a thread of execution. So, since the �thread of execution� has not begun yet, without a call to the start method, it would be inappropriate to say that it has a priority of 5.


Just stay focused.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
As you can easily determine by reading the java.lang.Thread JavaDocs - a newly created Thread has the same priority as the creating Thread.
I agree. Here's the link:
subject: A question about thread
It's not a secret anymore!