How to Extend Thread Class
public class Threads1 extends Thread { public static void main(String args[]) { Threads1 objThreads1 = new Threads1(); } Threads1() { start(); } public void run() { System.out.println("Thread Started"); for(int i=0;i<5;i++) { System.out.println(i); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("Thread Completed"); } }