Java util.timer fixed delay not working?

后端 未结 1 1861
无人共我
无人共我 2021-01-25 09:12

I tried to see how a timer\'s fixed delay method (schedule) works but looks like i failed.

This is my code :

public class Timer_Test {    
  static Timer         


        
相关标签:
1条回答
  • 2021-01-25 09:49

    Nope, that's how it is intended to work. The period is the period between start times, not the period between an end time and the next start time.

    Basically you're telling it in plain english "start at 1 second and execute every two seconds after that" so 1, 3, 5, 7, etc is the logical interpretation.

    0 讨论(0)
提交回复
热议问题