ExplanationAs soon as you click the "Start" button, the program creates a new thread to call the dangerousLoop() method of remote object. Now, if you click the "Exit" button, the application has the opportunity to notice the event, and process the "Exit" action. Run the program, and see the difference. Figure 10.2
The java.lang.Thread Classpublic class Thread extends Object implements Runnable Constructor
Methods
There are two ways to create a thread. One is to declare a class to
be a subclass of Thread class
|
||
|
||
Copyright © 2001 www.universalteacher.com |
||