public class CurrentThreadName {
public static void main(String[] args) {
//to get name of current thread
System.out.println(Thread.currentThread().getName());
//to set name of current thread
Thread.currentThread().setName("javainvent");
//getting name of current thread after invoking set name
//main thread name can also be changed
//main thread is created by JVM
System.out.println(Thread.currentThread().getName());
System.out.println(0 / 0);
}
}