Every thread has a priority, which is an integer from 1 to 10 : Thread Priority « Thread « SCJP






class DownCounter implements Runnable {
  public void run() {
    for (int i = 10; i >= 1; i--) {
      System.out.println("Counting Down: " + i);
    }
  }
}

public class MainClass {
  public static void main(String[] argv) {
    DownCounter dc = new DownCounter();
    Thread t = new Thread(dc);
    t.start();

    int oldPriority = t.getPriority();
    int newPriority = Math.min(oldPriority + 1, Thread.MAX_PRIORITY);
    t.setPriority(newPriority);

  }
}
Counting Down: 10
Counting Down: 9
Counting Down: 8
Counting Down: 7
Counting Down: 6
Counting Down: 5
Counting Down: 4
Counting Down: 3
Counting Down: 2
Counting Down: 1








7.3.Thread Priority
7.3.1.Thread Priorities
7.3.2.Thread class defines constants for MIN_PRIORITY (which is 1) and NORM_PRIORITY (which is 5).
7.3.3.Every thread has a priority, which is an integer from 1 to 10
7.3.4.The default priority is 5