Skip to main content

Program to implement sleep method in java

 import java.io.*;

 class A extends Thread

{

public void run(){


for(int i=0;i<10;i++){



System.out.println(i);


try{

Thread.sleep(5000);

}catch(Exception e){}

}


}


public static void main(String[] args)throws Exception

{

A a=new A();

a.start();

}

}

Comments

Popular posts from this blog

unix commands