java - Delay a for loop for a certain number of seconds -


i have loop this:

for (int = 0; < 10; i++) {   //do   //delay 5 seconds go next iteration of loop  } 

how specify delay in java?

the default way thread.sleep(5000). used in context of multithreading.

for (int = 0; < 10; i++) {     //do      //delay 5 seconds go next iteration of loop     try {         thread.sleep(5000);     } catch (interruptedexception e) {         // todo auto-generated catch block         e.printstacktrace();     } } 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -