Java Thread setName() method
The setName() method of thread class is used to change the name of the thread.
SecurityException: This exception throws if the current thread cannot modify the thread.
ExampleTest it Now
After changing name of t1: Sonoo Jaiswal running... running... After changing name of t2: javatpoint