Sleep(50); why is this used code example
Example 1: sleep() java
import java.util.concurrent.TimeUnit
try {
TimeUnit.SECONDS.sleep(1);
}
catch (Exception e) {
System.out.println("Oops! Something went wrong!")
}
Example 2: java thread class sleep
Thread.sleep(2000);