Let’s go through the given program to understand the concept behind overriding start method n java.
coming soon
class Sample extends Thread
{
public void start()
{
System.out.println("start method");
}
public void run()
{
System.out.println("run method");
}
public static void main(String args[])
{
Sample t1=new Sample();
t1.start(); // creating a new thread
System.out.println("main thread");
}
}
Ouput: