⟩ Explain the method of Thread class with example?
In this method of creating thread, we have to extend the Thread class and override the run() method in our class to create a Thread.
We have to create an object of the our class.
Once the object is created then we have to invoke the start() method and it will generate a new thread of execution.
For example
public class MyThread extends Thread{
public void run(){
// code to execute under the thread
}
public static void main(String [] args){
MyThread c = new MyThread();
c.start();
}
}