Thread Class
Package: java.lang
The Thread class lets you create an object that can be run as a thread in a multithreaded Java application.
Note that an alternative to using the Thread class to crate multithreaded applications is to use the Runnable interface. For more information, see Runnable Interface.
Constructors
|
Constructor |
Description |
|
|
Creates an instance of the |
|
|
Creates a |
|
|
Turns any object that implements an API interface called |
|
|
Creates a thread from any object that implements |
Methods
|
Method |
Description |
|
|
Returns the number of active threads. |
|
|
Fills the specified array with a copy of each active thread. The return value is the number of threads added to the array. |
|
|
Returns the name of the thread. |
|
|
Returns the thread’s priority. |
|
|
Interrupts this thread. |
|
|
Checks whether the thread has been interrupted. |
|
|
Sets the thread’s priority. |
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access