Java Data Type Tutorial - Java Thread NORM_PRIORITY








Syntax

Thread.NORM_PRIORITY has the following syntax.

public static final int NORM_PRIORITY

Example

In the following code shows how to use Thread.NORM_PRIORITY field.

/* w w  w. jav  a2s.co  m*/
public class Main {

  public static void main(String[] args) {

    Thread t = Thread.currentThread();
    t.setName("java2s.com thread");
    // set thread priority to 1
    t.setPriority(Thread.NORM_PRIORITY);

    System.out.println("Thread = " + t);

    int count = Thread.activeCount();
    System.out.println("currently active threads = " + count);
  }
}

The code above generates the following result.