Java Reference
In-Depth Information
5. You need to be careful about what operations you perform on the main thread. For ex-
ample, if you add the following code to the end of main( ) , the program will never
terminate because it will be waiting for the main thread to end!
Chapter 11 Self Test
1 . How does Java's multithreading capability enable you to write more efficient pro-
grams?
2 . Multithreading is supported by the _________ class and the ________ interface.
3 . When creating a runnable object, why might you want to extend Thread rather than
implement Runnable ?
4 . Show how to use join( ) to wait for a thread object called MyThrd to end.
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?
7 . The wait( ) and notify( ) methods are used to perform _______________________.
Search WWH ::




Custom Search