python time.sleep(x) in java
Posted: Thu Sep 27, 2018 11:39 pm
Hello, in python, when I need to call a delay action, I can use time.sleep(x). What is it in Java?
Thread.sleep() ? Thanks.
Thread.sleep() ? Thanks.
A small, affordable computer with free resources to help people learn, make things, and have fun
https://www.raspberrypi.org/forums/
https://www.raspberrypi.org/forums/viewtopic.php?f=81&t=223588
The sleep() method in the Thread class is a static method and has nothing to do with any Thread in particular; you can use it and it makes your curent fall to sleep. The method can be interrupted (not very likely) but you have to embed it in a try ... catch block.tony1812 wrote: ↑Fri Sep 28, 2018 10:21 amPlease don't give me the attitude. I did google it, I read the same post. but My little understanding is Thread.sleep() has something to do with a thread.. I am wondering if it can be applied to general purpose like time.sleep() in python.
I am not a genius like you. Java is brand new to me.