Pls help me to understand how can we make a thread to sleep for a infinite time period .
You can specify Timeout. Infinite for the millisecondsTimeout parameter to suspend the thread indefinitely.
Thread. sleep() method can be used to pause the execution of current thread for specified time in milliseconds.
Thread.currentThread().join();
Will sleep until the JVM is killed.
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