wood burning stoves 2.0*
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Thread Priority