June 2004
Intermediate to advanced
848 pages
21h 28m
English
We have already covered how a thread is created, and how the start() method inherited from Thread causes execution to start in its run() method. An individual thread dies when execution falls off the end of run() or otherwise leaves the run method (through an exception or return statement).
If an exception is thrown from the run method, the runtime system prints a message saying so, the thread terminates, but the exception does not propagate back into the code that created or started the thread. What this means is that once you start up a separate thread, it doesn't come back to interfere with the code that spawned it.
Threads have priorities that you can set and change. A higher priority thread executes ...
Read now
Unlock full access