正文

Java程序等待一段时间,可以这样操作:使用`Thread.sleep()`方法。例如,让程序等待5秒钟,可以写`Thread.sleep(5000)`。记得在调用此方法前捕获`InterruptedException`异常。