Basic HTML version of Foils prepared May 12 1996

Foil 93 Threads as Discussed in Sun's Tutorial

From CRPC Lectures on Java Language Applets Graphics CRPC Annual Meeting Tutorial -- May 14,1996. by Geoffrey C. Fox


1 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)
2 Only the second way is possible for applets as these already extend Applet class and so cannot multiply inherit from the Thread class
3 Threads must have a run method which is code Thread executes.
4 If you are using first way, this is written for this particular thread and overrides run() in Thread class
5 In second way, the created Thread automatically takes its run() method to be the run method of the applet

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 Sun Dec 14 1997