• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Priority

 
josephine chen
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, no... The new thread priority is the same as priority of the thread doing the creation. It is inherited.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic