Question:
I want to make my Java program pause for a specified amount of time, but I don't want to use a threading implementation. How can I do this?
Answer:
You really cannot avoid using threads in Java because the Java virtual machine automatically starts at least two separate threads. One thread is the low priority garbage collection thread and the other thread is the one that runs your main program. Graphical programs may automatically
start a third or even additional threads to manage the GUI.
To pause your program for a specified
amount of time, all you have to
do is call the static method Thread.sleep(),
which will suspend the calling thread for
the specified number of milliseconds.
To pause your program indefinitely, you
must get a handle to the main thread and call
its suspend() method. You can then
resume the thread at a later time by calling
the resume() method from a separate thread.