In java.util.Timer.scheduleAtFixedRate(TimerTask timer, long delay, long period)
,
what is the difference between delay
and period
?
For such things, always see the (Java SDK) JavaDocs: https://docs.oracle.com/javase/8/docs/api/java/util/Timer.html#scheduleAtFixedRate-java.util.TimerTask-long-long-
delay - delay in milliseconds before task is to be executed.
period - time in milliseconds between successive task executions.
(Your IDE should also show it to you automatically)
So delay is the time from now till the first execution, and after that it executes every period milliseconds again.
An other good way to find out: Use two different values for delay and period, and a TimerTask
that just prints a line to the console. Then see what happens.