Class java.lang.Thread


  • Java supports parallel concepts.
  • Class Thread implements this concept.
  • Every program has at least one thread.
  • Every program can have unlimited threads.
  • Threads will run concurrrent (if possible, otherwise round robin)
  • Storage class synchronized is used to block functions that must not be parallel (e.g. access to resources or static variables should be synchronized)
  • Classes that shall start an extra thread extend Thread or must pass an implementation of a Runnable class to a thread constructor.
  • Used for:
    • Applets running permanently in the background such as animations.
    • Parallel calculations.
    • Listeners (e.g. for events or for input).
  • Use yield() or sleep() at busy waiting routines!

Java Tutorial - Standard Classes Jens Trapp, 1997