int i=0;
while (i<30)
{
System.out.println("HelloWorld");
try{
Thread.currentThread().sleep(1000);
}catch(Exception e){
}
}

解决方案 »

  1.   

    int i=0;
    while (i<30)
    {
    System.out.println("HelloWorld");
    i = i + 1;
    sleep(1000);
    }
      

  2.   

    int i=0;
    while (i<30)
    {
    System.out.println("HelloWorld");
    i = i + 1;
    sleep(1000);
    }
      

  3.   

    谢谢大虾!!不过我知道好像还有个 wait 这是怎么用的??
    sleep(?) 是毫秒的单位吗?
      

  4.   

    int i=0;
    while (i<30)
    {
    System.out.println("HelloWorld");
    i = i + 1;
    sleep(1000);
    }
      

  5.   

    wait只是用于线程中,结贴就可以给我加分了
      

  6.   

    try{
    Thread.sleep(1000);
    }catch(Exception e){
    }
    sleep的单位是毫秒
    wait主要由于线程同步,一般不用它作延时