Thread Identities in java | Core Java Tutorials

This “Thread identities in Java” page is providing clear information about default identities of thread and how to set priorities to threads either by using constructor or using setName() method of Thread class.


Thread Identities:

  • Every thread is having default identity.
  • JVM invokes the threads using their identities only.
  • Every thread is initially identified by default name.
  • Default names set by Thread class default constructor in Thread creation process.
  • The following method is used to check identity of thread.
    • public final String getName()


  • Checking identities of multiple threads:


Setting Identity to the Thread explicitly:

  • It is possible to set the identity to thread in 2 ways
    1. In the process of Construction of Thread, using Thread class constructor.
    2. In the process of Execution of Thread, we can rename the thread.


Using constructor:


Setting identity using setter method:


Share this