How to set and get the name of a thread?
You can assign a name to thread instance by using the
setName() method and get the name of the thread using the
getName() method. The naming support is also available as a constructor of the
Thread class such as
Thread(String name) and
Thread(Runnable target, String name).