The first thread which starts running automatically when a Java program starts is known as the main thread. Other threads are child threads of the main thread. Usually main thread is also the last thread to stop execution of a program. Thread groups are used to control a set of threads.
1) currentThread method: Main thread can be controlled by a Thread object by calling currentThread method.
static Thread currentThread( )
2) sleep method: It is used to suspend a thread for milliseconds.
static void sleep(long milliseconds) throws InterruptedException
It can also be used to suspend a thread for milliseconds and nanoseconds
static void sleep(long milliseconds, int nanoseconds) throws InterruptedException
3) setName method: This method is used to set the name of a thread.
final void setName(String name_of_thread)
4) getName method: It is used to get the name of a thread.
final String getName( )