Thread Class Methods Flashcards
Returns reference to the current thread.
Thread.currentThread()
Returns the name of the current thread.
String getName()
Returns the priority value of the current thread.
int getPriority()
The current thread invoking this method on another thread waits until the other thread dies. Overloaded to be able to give the timeout in milliseconds or milliseconds and nanoseconds.
void join()
Once you start a thread using the start() method, this method will be called when the thread is ready to execute.
void run()
Changes the name of the thread to the given name in the argument.
void setName(String name)
Sets the priority of the thread to the given argument value.
void setPriority(int priorityValue)
Makes the current thread sleep for given milliseconds or milliseconds and nanoseconds.
Thread.sleep(long milliseconds, int nanoseconds)
Starts the thread; JVM calls the run() method of the thread.
void start()
Overridden method of Object that returns the string representation of the thread. Has the threads name, priority, and group.
String toString()