From the course: Java Threads

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Other useful methods of the Thread class

Other useful methods of the Thread class - Java Tutorial

From the course: Java Threads

Other useful methods of the Thread class

- [Instructor] The Thread class has a few other instance and static methods that come in handy when you're creating multi-threaded applications. For example, you can invoke the getId method on a thread instance, which will return the unique identifier of that thread. The identifier will always be a positive long value. It's generated at the time of thread creation. When the thread is terminated, the ID could be reused by another thread. The getName instance method returns the name of the thread on which it's invoked. You know already that all threads are assigned a priority value. This value is assigned at the time of thread creation, and its value falls within the range of 1 to 10. 1 is the minimum priority, and 10 is the maximum priority. The priority of a thread can be retrieved using the getPriority instance method that returns an int value between 1 and 10. The getState instance method returns the status of the thread…

Contents