Tag: set thread name


  • Set and Get the Name

    Thread in Java Table Of Contents Getting Thread Name Setting Name to Thread Using Thread Constructor Using Thread.setName() 1. Getting Thread Name By default, the Java compiler sets a default name of each thread while creating, and we can get the thread name by using the Thread.currentThread().getName() method. In the following example, we created a Thread by implementing the Runnable interface and…