• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

threads??

 
Tim Dinkel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
Im trying to develop an applet that will use multiple threads.
And I have some questions...
If I want to have one class running as a thread, this can be done like this, right?

Or should I place the code that I have in start() in the constructor?
Does the class myApplet need to implement runnable or is it enough that ThreadObj does that.
How do I suspend and resume threads?
I want the thread to suspend (pause) itself and be resumed bu the parent.
 
Joe Ess
Bartender
Posts: 9337
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should read the Java Tutorial chapter on threads. It explains a great deal of what you are wondering about. The bottom line is that you make a class class by extending Thread or implement Runnable, then implement a method with the signiture:

This is the method that will be executed in the new thread. Then you start the new thread of execution by either creating a new Thread for a class that implements Runnable:

or invoking start() on an instance of a class that extends Thread.
[ January 16, 2004: Message edited by: Joe Ess ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic