Thread
class.
Thread constructors,
it is still not actually running.
It starts running when its start method is called.
This method in turn calls the thread's run method.
Thread class.
In this case, the run method that is called by start
is defined in this class; this definition overrides run in
Thread.
run method exits.
Thread method
sleep(long), where the argument specifies the number
of milliseconds to sleep (long is an integer type allowing
numbers with greater absolute values than int).
Note that this method throws an InterruptedException, which
has to be caught in the method definition.
Timer class instead (the one discussed here
is the one in the Swing package: javax.swing.Timer).
actionPerformed
method.
Timer is of the form
Time(int delay, ActionListener listener).
delay represents the delay in milliseconds,
and listener is an action listener that is automatically registered as listening to the
timer.
Timer methods are start() and stop(), with the obvious
meanings.
Timer.