Thread.sleep(延时毫秒数);注意要用try、catch捕获异常

解决方案 »

  1.   

    try{
    Thread.sleep(5000);//stop 5 seconds
    }
    catch(InterruptedException e){

    }
      

  2.   

    请问: zjpangxie(又胡了)如果不捕获异常会怎么样?
      

  3.   

    请问: zjpangxie(又胡了)如果不捕获异常会怎么样?会提示错误!
      

  4.   

    如果不是 Thread 而是一般的进程 ,如何延时?  查找发现 wait() 函数,但是使用会出错
      

  5.   

    一般的进程也可以那样用的!实在不行就这样:for(int i=0;i<10000000;i++);
      

  6.   

    wait() ro waiFor()是等待子进程结束!
    public class InterruptedException
    extends Exception 
    Thrown when a thread is waiting, sleeping, or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread.