Basic HTML version of Foils prepared 17 Nov 97

Foil 4 How to Use Threads

From Java Tutorial, July 1, 1996 CEWES Tutorial, CPS606, JSU Class CSC499 -- July 22-25 1997, Fall 97. by Nancy J. McCracken,Geoffrey C. Fox, Tom Scavo

API to show relationship between Thread class and Runnable interface for Foil 4
1 One can implement threads in two ways:
  • First, by subclassing the Thread class
  • Second, by implementing the Runnable interface
2 A class that implements the Runnable interface (including the Thread class itself) must implement the run() method containing the "body" of the thread.
3 The Runnable interface makes it possible for an applet to utilize threads. (Remember, an applet extends the Applet class and so cannot multiply inherit from the Thread class.)

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998