I have tried to delay - or put to sleep - my Java program, but an error occurs.
(我试图延迟-或使我的Java程序进入睡眠状态,但是发生错误。)
I'm unable to use Thread.sleep(x)
or wait()
.
(我无法使用Thread.sleep(x)
或wait()
。)
The same error message appears: (出现相同的错误消息:)
unreported exception java.lang.InterruptedException;
(未报告的异常java.lang.InterruptedException;)
must be caught or declared to be thrown. (必须被抓住或宣布被抛出。)
Is there any step required before using the Thread.sleep()
or wait()
methods?
(使用Thread.sleep()
或wait()
方法之前是否需要任何步骤?)
ask by vincent low translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…