Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
import java.util.Timer;
import java.util.TimerTask;
public class Task2 {
public static void main(String[] args) {
TimerTask task = new TimerTask() {
public void run() {
// task to run goes here
System.out.println("Hello !!!");
Timer timer = new Timer();
long delay = 0;
long intevalPeriod = 1 * 1000;
// schedules the task to be run in an interval
timer.scheduleAtFixedRate(task, delay,
} // end of main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment