Java Thread Methods

Java Thread Methods

S.N.Modifier and TypeMethodDescription
1)voidstart()It is used to start the execution of the thread.
2)voidrun()It is used to do an action for a thread.
3)static voidsleep()It sleeps a thread for the specified amount of time.
4)static ThreadcurrentThread()It returns a reference to the currently executing thread object.
5)voidjoin()It waits for a thread to die.
6)intgetPriority()It returns the priority of the thread.
7)voidsetPriority()It changes the priority of the thread.
8)StringgetName()It returns the name of the thread.
9)voidsetName()It changes the name of the thread.
10)longgetId()It returns the id of the thread.
11)booleanisAlive()It tests if the thread is alive.

Comments