FileDocCategorySizeDatePackage
RunnableThread.javaAPI DocExample1538Tue May 01 16:44:08 BST 2001None

RunnableThread

public class RunnableThread extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        MyRunnable nr = new MyRunnable();  // create a new thread of execution object

         try
            {
              for(int i=5; i>0; i--)
                 {
                   System.out.println("Main Thread : " + i);
                   Thread.sleep(1000);  //put main thread to sleep yeild the CPU
                 }
             }
         catch(InterruptedException e)
             {
               System.out.println("Main thread interrupted.");
             }
         System.out.println("Main thread exiting.");