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 -

how does one get csharp-sqlite to throw exceptions for duplicates or foreign key constraint violations -

Simple Angular 2 project fails 'Unexpected reserved word' -