How to make time delay in java. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make time delay in java.

17th Jan 2017, 12:31 AM
Prakhar Bhandari
Prakhar Bhandari - avatar
2 Answers
+ 2
try { Thread.sleep(milliseconds); } catch (InterruptedException e) { }
17th Jan 2017, 1:37 AM
Ahmed Elzoughby
Ahmed Elzoughby - avatar
0
You can use Thread.sleep(time); /* time in milliseconds */ I think you need to surround it with a try/catch though.
17th Jan 2017, 1:13 AM
Robobrine
Robobrine - avatar