class ThDemo extends Thread { public void run() { System.out.println("Current thread is: "+Thread.currentThread().getName()); } } public class MAin { public static void main(String args[]) { ThDemo d1=new ThDemo(); d1.start(); } }
Current thread is: Thread-0