How do you make a program that waits for 3 seconds? I've heard about this:
obj.wait()
But I'm just wondering about the syntax and what to import?
How do you make a program that waits for 3 seconds? I've heard about this:
obj.wait()
But I'm just wondering about the syntax and what to import?
This will put your code to sleep for 3 seconds:
try{
Thread.sleep(3000);
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
}
You have to import `
java.util.concurrent.TimeUnit
`and the you can run:
TimeUnit.SECONDS.sleep(100);