| |

Pausing thread for a time in java

 

package net.javamix.blog.basics.thread;

public class ThreadRunning {
public static void main(String[] args) {
System.out.println(“Printing started !!”);
try {
while (true) {
System.out.println(“Javamix.net”);
//pausing thread for 60 seconds
Thread.sleep(60000);
}

} catch (InterruptedException e) {
System.out.println(“thread inturpted”);
e.printStackTrace();
}
}

}


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *