Last active
August 29, 2015 13:57
-
-
Save ajduke/9889980 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Timer; | |
import java.util.TimerTask; | |
public class Task2 { | |
public static void main(String[] args) { | |
TimerTask task = new TimerTask() { | |
@Override | |
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, | |
intevalPeriod); | |
} // end of main | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment