# Importance of Thread Priority in Java?

JavaObject Oriented ProgrammingProgramming

In multi-threaded applications, each thread is assigned with a priority. The processor is assigned to the thread by the thread scheduler based on its priority i.e. the highest priority thread is assigned the processor first and so on. The default priority of a thread with a value of '5'. We can get the priority of a thread using the getPriority() method of Thread class.

The three static values defined in the Thread class for the priority of a thread

## MAX_PRIORITY

This is the maximum thread priority with a value of 10.

## NORM_PRIORITY

This is the default thread priority with a value of 5.

## MIN_PRIORITY

This is the minimum thread priority with a value of 1.

## Syntax

public final int getPriority()

## Example

public class ThreadPriorityTest extends Thread {
public static void main(String[]args) {
}
Default thread priority of thread1: 5
New thread priority of thread3: 6