Javatpoint Logo
Javatpoint Logo

Java Thread getId() method

The getId() method is used to return the thread identifier. The thread ID is a unique positive number which was generated at the time of thread creation.

The thread ID remains unchanged during its lifetime. When the thread is terminated, the ID of thread can be reused.

Syntax

Return

Example

Test it Now

Output:

Name of t1: Thread-0
Id of t1: 21
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