A process consists of many semi-processes known as threads.
A thread is the smallest executable code in a Java program, which contributesin making it possible to run multiple tasks at a time.
A thread object can be created by extending the Thread class that defines therun() method.
It can also be created by declaring a class that implements the Runnableinterface and passing the object to the Thread constructor.
A newly created thread can be in following states: new, runnable, waiting,blocked, and terminated.
The getName() method returns the name of the thread while start() allows athread to be in runnable state.
The setPriority() and getPriority() methods are used to assign and retrieve thepriority of any thread respectively.
The daemon thread runs independently of the default user thread in aprogram, providing back ground service like the mouse event, garbagecollection, and so on.