How to repeatedly call a function after a certain amount of time
java
Solution
Using `java.util.Timer.scheduleAtFixedRate()` and `java.util.TimerTask` is a possible solution:
Timer t = new Timer();
t.scheduleAtFixedRate(
new TimerTask()
{
public void run()
{
System.out.println("hello");
}
},
0, // run first occurrence immediatetly
2000)); // run every two seconds
Problem
I want to make a function that will be called after certain amount of time. Also, this should be repeated after the same amount of time. For example, the function may be called every 60 seconds.