public class Program {
public static void main(String[] args) {
Thread thrd1 = new Thread("Thread1");
Thread thrd2 = new Thread("Thread2");
thrd1.start();
thrd2.start();
String threadName = thrd1.getName();
System.out.println("Thread Name: " + threadName);
threadName = thrd2.getName();
System.out.println("Thread Name: " + threadName);
}
}
/*
run:
Thread Name: Thread1
Thread Name: Thread2
*/