Java examples for Thread:Thread Operation
Set Thread Name
public class Main { public static void main(String[] args) { //from www . ja v a2 s . com //get currently running thread object Thread currentThread = Thread.currentThread(); System.out.println(currentThread); currentThread.setName("Set Thread Name Example"); System.out.println("Thread Name : "+ currentThread.getName()); } }