How would I have this method run every couple of seconds in a recursive function. I want the i variable to update by 1 every couple of seconds than print it to the console. In javascript I could use setTimeout is there a method like the javascript setTimeout in Java?
final i = 0;
public void timerActions() {
i = i + 1;
System.out.println(i);
}
Thread.sleep(1000);if this is just for fun.