java how to sleep thread code example
Example 1: java sleep in code
import java.util.concurrent.TimeUnit
TimeUnit.SECONDS.sleep(1);
or
TimeUnit.MINUTES.sleep(1);
Example 2: java thread class sleep
Thread.sleep(2000);
import java.util.concurrent.TimeUnit
TimeUnit.SECONDS.sleep(1);
or
TimeUnit.MINUTES.sleep(1);
Thread.sleep(2000);