-
What is the name of the thread in output of this program?
public class multithreaded_Name
{
public static void main(String args[])
{
Thread thread = Thread.currentThread();
thread.setName("First");
System.out.println(thread);
}
}
-
- First
- main
- Thread
- All of above
- None of these
Correct Option: A
The output of program is Thread[First,5,main], Since we have not explicitly named the thread they are named by the group to they belong i:e main method. Hence they are named ‘main’.