The StrictMath class defines a complete set of mathematical methods that parallel those
in Math. The difference is that the StrictMath version is guaranteed to generate precisely
identical results across all Java implementations, whereas the methods in Math are given
more latitude in order to improve performance.
The Compiler class supports the creation of Java environments in which Java bytecode is
compiled into executable code rather than interpreted. It is not for normal programming use.
Thread, ThreadGroup, and Runnable
The Runnable interface and the Thread and ThreadGroup classes support multithreaded
programming. Each is examined next.
NOTE An overview of the techniques used to manage threads, implement the Runnable interface,
and create multithreaded programs is presented in Chapter 11.
The Runnable Interface
The Runnable interface must be implemented by any class that will initiate a separate thread
of execution. Runnable only defines one abstract method, called run( ), which is the entry
point to the thread. It is defined like this:
void run( )
Threads that you create must implement this method.
Thread creates a new thread of execution. It defines the following commonly used constructors:
Thread(Runnable threadOb, String threadName)
Thread(ThreadGroup groupOb, Runnable threadOb)
Thread(ThreadGroup groupOb, Runnable threadOb, String threadName)
Thread(ThreadGroup groupOb, String threadName)
threadOb is an instance of a class that implements the Runnable interface and defines where
execution of the thread will begin. The name of the thread is specified by threadName. When a
name is not specified, one is created by the Java Virtual Machine. groupOb specifies the thread
group to which the new thread will belong. When no thread group is specified, the new thread
belongs to the same group as the parent thread.
The following constants are defined by Thread:
Search WWH :