问题
Basically I want a function to be called every say, 10 milliseconds.
How can I achieve that in Java?
回答1:
You might want to take a look at Timer.
回答2:
Check out java.util.Timer
http://java.sun.com/javase/6/docs/api/java/util/Timer.html
回答3:
You could also use a ScheduleExecutorService.
回答4:
I would say you would create a thread and in the thread loop add a System.sleep(10) to make the thread "sleep" for 10 ms before continuing.
来源:https://stackoverflow.com/questions/652389/java-equivalent-of-setinterval-in-javascript