如何在Java中使上一次循环与下一次循环之间停顿几秒

请高手多指教!!!谢谢!!!

第1个回答  推荐于2017-09-25
public class Test {
public static void main(String[] args) {

for(int i=0 ;i<10 ;i++){
try {
Thread.currentThread().sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("now is " + System.currentTimeMillis());
}
}
}
第2个回答  2010-03-21
停三秒
sleep(3000)
第3个回答  2010-03-21
Thread.sleep(3000);
第4个回答  2010-03-21
Thread.Sleep