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 not sure if there is a function in Java that does that or do I need to write the function by myself and how would i do that.
Representing heap sport is a homework but writing the waiting function isn't so I appreciate your help
You're looking for Thread.sleep(int milliseconds)
Thread.sleep()
is what you are looking for.
The exception it throws will likely puzzle you if you are a Java newbie. Most likely you will want to propagate it up or discard it and reset the interrupt flag using Thread.currentThread().interrupt()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With