Java Reference
In-Depth Information
5 . Show how to set a thread called MyThrd to three levels above normal priority.
6 . What is the effect of adding the synchronized keyword to a method?
Adding synchronized to a method allows only one thread at a time to use the method
for any given object of its class.
7 . The wait( ) and notify( ) methods are used to perform ____________________.
interthread communication
8 . Change the TickTock class so that it actually keeps time. That is, have each tick take
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:
Search WWH ::




Custom Search