Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger


Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Posts: 9612
Mac OS X Linux 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 ]
A teeny tiny vulgar attempt to get you to buy our stuff
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic