Skip to content

Instantly share code, notes, and snippets.

@ojacobson
Created May 21, 2013 15:02
Show Gist options
  • Save ojacobson/5620500 to your computer and use it in GitHub Desktop.
Save ojacobson/5620500 to your computer and use it in GitHub Desktop.
package com.example.estobhan;
import java.util.Timer;
import java.util.TimerTask;
public class TimerExample {
private static final long PERIOD = 5000;
public static void main(String[] args) {
final Timer timer = new Timer();
TimerTask periodicMessage = new TimerTask() {
@Override
public void run() {
System.out.println("Tick.");
}
};
timer.schedule(periodicMessage, PERIOD, PERIOD);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment