Matrix4290 :
I use a while loop to repeat my codes in my program. I want to repeat a code 1000 times per second. How can I do this?
SDJ :
For the fixed-delay execution of some code, it might be a better approach to use a timer object, such as java.util.Timer or javax.swing.Timer, or even AnimationTimer, depending on what you're trying to accomplish. This being said, it's not possible to guarantee a frequency and a frequency of 1000/s (or period of 1ms) is quite fast, and java.util.Timer
and javax.swing.Timer
won't be able to keep up.
See also: