September 22, 2010 at 12:54 PM
By using setPriority() method, you can change the priority of thread.
October 4, 2010 at 5:12 PM
In Java the JVM defines priorities for Java threads in the range of 1 to 10.
Following is the constaints defined in java.lang.Thread class:
java.lang.Thread.MIN_PRIORITY = 1
java.lang.Thread.NORM_PRIORITY = 5
java.lang.Thread.MAX_PRIORITY = 10
But you can set any priority from 1 to 10 in your program.
Following example shows how to set Thread priority:
MyThread thread1 = new Thread("thread1");