Home » JAVA Programming » Multithreading » Question
  1. What is the priority of the thread in output of this program?
    public class multithreaded_PriorityExample
    {
    public static void main(String args[])
    {
    Thread thread = Thread.currentThread();
    thread.setName("Thread One");
    System.out.println(thread.getPriority());
    }
    }
    1. 2
    2. 1
    3. 0
    4. 5
    5. 10
Correct Option: D

The getPriority() function is used to obtain the priority of the thread, in this code the priority given to thread is ‘5’.



Your comments will be displayed only after manual approval.