Java Thread setName() methodThe setName() method of thread class is used to change the name of the thread. SyntaxParameterReturnExceptionSecurityException: This exception throws if the current thread cannot modify the thread. ExampleTest it NowOutput: After changing name of t1: Sonoo Jaiswal running... running... After changing name of t2: javatpoint Next TopicMultithreading in Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India