a class from
and override the
print a message, then call
Repeat this three times, then return from
Put a start-up message in the constructor and override
to print a shut-down message. Make a separate thread class that calls
printing a message as it does so. Make several thread objects of both types and
run them to see what happens.
so that the thread is an inner class and doesn’t need to explicitly store
a handle to a
to add a
block inside the
instead of synchronizing the entire
subclasses, one with a
that starts up, captures the handle of the second
object and then calls
The other class’
for the first thread after some number of seconds have passed, so the first
thread can print out a message.
and explain the results. Replace the
and explain the results.
replace the call to
with a call to
for the thread group, causing it to wait for two seconds. For this to work
correctly you must acquire the lock for
instead of a
Experiment with different sleep times to see what happens.
In Chapter 7, locate the
example, which consists of three files. In
is based on watching the time. Change
so that it is a
and change the rest of the design so that it works with this new