+ 1

How to run runnable class every 1 sec?

10th Apr 2016, 11:37 AM
Hemanth S
Hemanth S - avatar
2 ответов
+ 3
You can use an infinite loop and sleep the thread for 1 sec. For example: while(true) { Thread.sleep(1000); // Waiting before run. // Actual work goes here. }
19th May 2016, 11:47 AM
James Flanders
0
U actually have to catch the exception here which is InterruptedException or something like this
1st Jul 2016, 1:45 PM
Aiden