Skip to content
Advertisement

Tag: thread-sleep

How do I make a delay in Java?

I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop. I want to build a step sequencer. How do I make a delay in Java? Answer If you want to pause then use java.util.concurrent.TimeUnit: To sleep for one second or To sleep for a minute.

Advertisement