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 - 如果另一个线程中断了当前线程。当抛出该异常时,当前线程的中断状态 被清除。 面试问题 诚心求jsp项目指导建议,和tomcat重启问题,高手帮忙 多线程问题 基于SOCKET的多线程聊天程序的问题 请高手指点,JAVA如何写注册表?(40分求助) 简单问题,是大侠一定没问题! 在创建自己的异常类时出错,请赐教! 能帮就一定要帮我~~~~~~~~~~` 关于连SQL SERVER的菜鸟问题 请问在NETSCAPE中如何将JAVA APPLET的权限修改为可对本地文件系统操作? 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 - 如果另一个线程中断了当前线程。当抛出该异常时,当前线程的中断状态 被清除。