sleep() 为什么要用try catch,它什么情况会产生异常呢? 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 @exception InterruptedException if any thread has interrupted * the current thread. The <i>interrupted status</i> of the * current thread is cleared when this exception is thrown. sleeppublic static void sleep(long millis) throws InterruptedException在指定的毫秒数内让当前正在执行的线程休眠(暂停执行)。该线程不丢失任何监视器的所属权。 参数:millis - 以毫秒为单位的休眠时间。 抛出: InterruptedException - 如果另一个线程中断了当前线程。当抛出该异常时,当前线程的中断状态 被清除。--------------------------------------------------------------------------------sleeppublic static void sleep(long millis, int nanos) throws InterruptedException在指定的毫秒数加指定的纳秒数内让当前正在执行的线程休眠(暂停执行)。该线程不丢失任何监视器的所属权。 参数:millis - 以毫秒为单位的休眠时间。nanos - 要休眠的另外 0-999999 纳秒。 抛出: IllegalArgumentException - 如果 millis 值为负或 nanos 值不在 0-999999 范围内。 InterruptedException - 如果另一个线程中断了当前线程。当抛出该异常时,当前线程的中断状态 被清除。 J2SE 一题, 求解。 关于Java正则表达 使用的问题? 日期格式 如何实现浮点数到字符串转换,类似与C++中的gcvt(...)函数 2000元求购一程序!!高手请进 文本文件导入sqlserver 关于调用存储过程master..xp_cmdshell做文本文件导入到SQLServer的几个问题?! 请问怎样使程序执行到t.start()停止,线程t结束才继续执行, 大家手上现在都在做什么项目,讲来听听,涨涨见识,进来有分喽 有关parseInt的问题 byte型变量的取值范围 format()???????
* the current thread. The <i>interrupted status</i> of the
* current thread is cleared when this exception is thrown.
public static void sleep(long millis)
throws InterruptedException在指定的毫秒数内让当前正在执行的线程休眠(暂停执行)。该线程不丢失任何监视器的所属权。 参数:
millis - 以毫秒为单位的休眠时间。
抛出:
InterruptedException - 如果另一个线程中断了当前线程。当抛出该异常时,当前线程的中断状态 被清除。
--------------------------------------------------------------------------------sleep
public static void sleep(long millis,
int nanos)
throws InterruptedException在指定的毫秒数加指定的纳秒数内让当前正在执行的线程休眠(暂停执行)。该线程不丢失任何监视器的所属权。 参数:
millis - 以毫秒为单位的休眠时间。
nanos - 要休眠的另外 0-999999 纳秒。
抛出:
IllegalArgumentException - 如果 millis 值为负或 nanos 值不在 0-999999 范围内。
InterruptedException - 如果另一个线程中断了当前线程。当抛出该异常时,当前线程的中断状态 被清除。