You're viewing this page with a browser that doesn't understand the APPLET tag. If you were using a Java-enabled browser that understood the APPLET tag, you'd see Scrolling Text here.

In this example, we can see a boundry on screen. But if you select the "Options" menu and check "Show Java Console", you will see "thread is working..." printout every 1 second. Now we are going to learn about "Thread".

What is Thread ?

A Thread is a single sequential flow of control within a process. This simply means that while executing within a program, each thread has a beginning, a sequence, a point of execution occurring at any time during runtime of the thread and of course, an ending. Thread objects are the basis for multi-threaded programming. Multi-threaded programming allows a single program to conduct concurrently running threads that perform different tasks.
A way to create and use a thread is by using the Runnable interface. This way any object that implements the Runnable interface can be run in a thread. For example:

class Test implements Runnable {
  public void run() {
    // thread is working here...
  }
}

To start a new thread you need to do the following:

  thread = new Thread(this);
  thread.start();

The virtual machine runs until all Threads that are not daemon Threads have died. A Thread dies when its run() method returns, or when the stop() method is called.

Class Hierarchy:
Applet --- Test

JAVA Source Code
1. Test.java (Main Program)