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

The output of program is Thread[main,5,main], in this priority assigned to the thread is 5. It’s the default value. Since we have not named the thread they are named by the group to they belong i:e main method.



Your comments will be displayed only after manual approval.