This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The priority of a Newly created Thread can be changed by the method public final void setPriority(int newPriority) ? True/False? The answer is false, and explain as below The priority of a newly created Thread depends on the Thread that created it。
But I think the answer explains an another concept and "true" should be the answer.
The initial priority of a new thread is indeed set equal to the priority of the thread that created it. However, the priority of a thread can be changed using the Thread.setPriority method after the new thread is created. The following is quoted from the javadoc of the Thread class.
public final void setPriority(int newPriority) Changes the priority of this thread. First the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException. Otherwise, the priority of this thread is set to the smaller of the specified newPriority and the maximum permitted priority of the thread's thread group.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
largem Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy. Thanks again and we hope to see you around the ranch!!