Thread Priorities in Java | Core Java Tutorials

This “Thread Priorities in Java” page is providing clear information about default identities of threads and how to set identities to threads explicitly.

core-Java-online-Training-4

Priority of a Thread:

  • Every thread can have the priority by which Operating System schedules the thread when it is in waiting (queue) state.
  • Threads having higher priority will be processed first.
  • Every thread is having default priority.
  • java.lang.Thread class contains Fields(pre-defined variables) to describe priorities of Thread.

 

Setting Priority to Thread:

  • It is possible to set priority to threads explicitly.
  • Thread class is providing pre-defined functionality to set priorities.

 

  • Exception when we try to set priority more than 10

core-Java-online-Training-4

Share this