javatutelearn.com
Easy Learning
Search Javatutelearn.com :
public class sleepthread extends Thread { public void run(){ try { Thread.sleep(5000); } catch (Exception e){ System.out.println("Error.."); } System.out.println(Thread.currentThread().getName()+ " is active now."); } public static void main (String args[]){ sleepthread t1 = new sleepthread(); t1.start(); } }
Thread-0 is active now