Javatpoint Logo
Javatpoint Logo

Java Thread getName() method

The getName() method of thread class is used to return the name of thread.

Syntax

Return

Example

Test it Now

Output:

Name of t1: Thread-0
Name of t2: Thread-1
Thread is running...
Thread is running...






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA