public class TimerTest extends TimerTask {
public static void main (
String[] args) {
TimerTask timerTest = new TimerTest();
Timer timer = new Timer(true);
Date now = new Date();
// let the job start from now with 5 seconds delay
timer.scheduleAtFixedRate(timerTest, now, 5*1000);
}
public void run() {
System.out.println("Running the task...");
}
}
However, in my
IDE console I can only see ONE print out. I am supposed to see a print out every 5 seconds but I can't see any but the first.
Why ??