time=System.currentTimeMillis();
while(System.currentTimeMillis() < (time + 1000));

解决方案 »

  1.   

    for()
     for():P是何意?请高手指教,:p用来干什么?
      

  2.   

    gutsyu(SL55AMG),time变量,我用什么数据类型来初始化它??
      

  3.   

    sleep()是静态方法,你可以不用创建Thread实例,直接使用Thread.sleep(1000)。不就可以了?
      

  4.   

    long time=System.currentTimeMillis();
    while(System.currentTimeMillis() < (time + 1000));
      

  5.   

    如果不用Thread.sleep()的话,你的程序就会完全停顿!
      

  6.   

    import java.lang.*;public class TestThread {
    public static void main(String [] args){
    System.out.println("whyin");
    try{
    Thread.sleep(1000);
    }catch(InterruptedException e){
    System.out.println(e.toString());
    }
    System.out.println("hong");
    }
    }
    //------------------//
    就是这样:
    try{
    Thread.sleep(1000);
    }catch(InterruptedException e){
    System.out.println(e.toString());
    }