Threads allows a program to operate more efficiently by doing multiple things at the same time.
Threads can be used to perform complicated tasks in the background without interrupting the main program.
It can be created by extending the Thread class and overriding its run() method:
Extend Syntax
public class MyClass extends Thread {
public void run() {
System.out.println(“This code is running in a thread”);
}
}