-
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());
}
}
-
- 2
- 1
- 0
- 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’.