wait/sleep for a specific amount of time
 
You can tell your application to wait/sleep for a specific amount of time. This is useful in loops for example. You can Execute the loop every second once.
The sleep function works for threads. You have to get the current thread first. Here is an example of the code:
try {
    Thread.currentThread().sleep(1000);
} catch (Exception e) {}


Here is the same code but in a loop, the way I like to use it. This executes the loop every second, for 20 seconds (sleep(1000) = sleep for 1000 milliseconds):
for(int i=0;i<20;i++)
{
    try {
        Thread.currentThread().sleep(1000);
    } catch (Exception e) {}
}
 
admin / Dec 05, 2004
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2019 / lookass.ch
makememad@lookass.ch