| | Controlling ThreadCreating a Thread Thread aThread = new SimpleThread("Jamaica");Starting a Thread aThread.start(); The run() method is the actual method
that contains the code to be execute by the thread. The
start() method calls the
run() method, causing the thread to begin
its execution. Making a Thread Not Runnable A thread bedomes Not Runnable when one of these events occurs: Its sleep method is invoked The thread cals the wait method to wait for a specific
condition to be satisified. The thread is blocking on I/O
Stopping a Thread A thread dies when the run method exits.
|