You can set the name of a thread by using setName( ). You can obtain the name of a thread by calling getName( ).
These methods are members of the Thread class and are declared like this:
final void setName(String threadName) final String getName( )
Here, threadName specifies the name of the thread.