Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suspend current thread for 20 seconds in java?

Tags:

java

How to suspend current thread for 20 seconds in java?

like image 533
Yatendra Avatar asked Sep 10 '09 19:09

Yatendra


3 Answers

Thread.sleep(20*1000);

like image 196
nos Avatar answered Sep 16 '22 16:09

nos


Thread.sleep(20000)

like image 27
Kevin Avatar answered Sep 20 '22 16:09

Kevin


you may also want to include the try catch:

try {
  Thread.sleep(20*1000);
} catch(InterruptedException e) { }
like image 21
mkoryak Avatar answered Sep 20 '22 16:09

mkoryak