This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Priority 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 "Thread Priority" Watch "Thread Priority" New topic
Author

Thread Priority

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
"m" will get the NORM_PRIORITY priority
or the priority of the thread that created it
that is can I say it is main thread
class A {
public static void main (String g[]){
Thread m = new Thread();
}
}
CitySlicker
Greenhorn

Joined: Feb 03, 2000
Posts: 16
If no explicit thread priority is set for a given thread, then the thread's priority is defaulted to 5 or Thread.NORM_PRIORITY.
add this line after the thread declaration:
<code>
System.out.println(m.getPriority());
</code>
and you'll see that it is 5.
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
No, no... The new thread priority is the same as priority of the thread doing the creation. It is inherited.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
wood burning stoves
 
subject: Thread Priority
 
Similar Threads
Thread Related Problem
Can we find the priority of main thread?
Thread Priority
why thread priority is not working here
Thread.NORM_PRIORITY, not the default thread priority???