Java Reference
In-Depth Information
Adding
synchronized
to a method allows only one thread at a time to use the method
for any given object of its class.
interthread communication
one half second, and each tock take one half second. Thus, each tick-tock will take
one second. (Don't worry about the time it takes to switch tasks, etc.)
To make the
TickTock
class actually keep time, simply add calls to
sleep( )
, as
shown here: