Thread Priorities in Java
If there are multiple threads in an application , then those threads reaches to the ready to run state based on thread priority.JVM contains a thread scheduler and it is managing the threads based on priorities. Priority is represented by an integer value from 1 to 10. A priority value of 1 means that thread is having the minimum priority value.A priority value of 10 means it has the maximum priority value. The default priority value is 5 .
In program it is possible to change the priority value using setPriority(int value) method of Thread class.Also there are constants to specify the priority value .Thread.MIN_PRIORITY , Thread.MAX_PRIORITY , Thread.NORM_PRIORITY are integer values 1 , 5 and 10.
But it is not preferable to develop multi-threaded applications by trusting the priority values . The behavior is different in different platforms and in different JVMs.