Wait function in Java

后端 未结 6 861
梦谈多话
梦谈多话 2020-12-11 08:19

So I am writing a Java code to represent a heap sort and to represent the operation I need to have a waiting function which will wait between different operation but I am no

6条回答
  •  既然无缘
    2020-12-11 08:34

    Here's something a little more in depth:

    try {
        Thread.sleep(1000); 
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    

    Here, we've inserted 1000 as the milliseconds value, or 1 second wait before running the rest of your code. This works with any program in Java.

提交回复
热议问题