HELP! * GREY=local LOCAL HTML version of Foils prepared July 10 1996

Foil 107 Threads as Discussed in Sun's Tutorial

From Basic Lectures on Java Language Applets Graphics Networking Trip to China and Icase Tutorial -- July 12-28 and June 10-13 96. by Geoffrey C. Fox * See also color IMAGE

One can implement threads in two ways
  • Firstly subclassing the Thread class and overriding its run() method
  • Secondly by creating a Thread with a Runnable object (i. e. that implements Runnable interface)
Only the second way is possible for applets as these already extend Applet class and so cannot multiply inherit from the Thread class
Threads must have a run method which is code Thread executes.
If you are using first way, this is written for this particular thread and overrides run() in Thread class
In second way, the created Thread automatically takes its run() method to be the run method of the applet



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 Tue Feb 18 1997