Chapter 18

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Appendix C.  Answers to Review Questions


A1:

Processes contain threads. Threads are lightweight processes that are handled by the JVM instead of by the operating system.

A2:

The sleep() method is declared to be static, which means that there is only one copy of this method and that it resides at the class level. As a result, you can call it with either a handle to an instance or the name of the class. The preferred approach is to call it with the name of the class.

A3:

The synchronize keyword signals that locks should be used to allow only one thread at the time to access a method.

A4:

The simple join() method will wait forever for another process to finish. The version that takes a parameter n will time out after n milliseconds and resume the thread's execution, with or without the other thread finishing.


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net