Can Timers only have one task?
Hey there,
I'm working on an animation class for one of my programs, and sometimes I need to adjust the frame delay.
I'm working with Timers from java.util.Timer and I'm wondering if when I call the "schedule()" method, does it override the current task, or will it add a task.
Ex: Will this code:
Code:
Timer t = new Timer();
// First task, at 50 milisecs
t.schedule(new TimerTask() {
@Override
public void run() {
// Code here
}
}, 0, 50);
// Second task, at 100 milisecs
t.schedule(new TimerTask() {
@Override
public void run() {
// Code here
}
}, 0, 100);
So will the second task override the first one, or will both tasks be executed at the specified intervals?