home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / Runnable.java < prev    next >
Text File  |  1998-01-23  |  3KB  |  65 lines

  1. /*
  2.  * @(#)Runnable.java    1.13 97/08/25
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.lang;
  24.  
  25. /**
  26.  * The <code>Runnable</code> interface should be implemented by any 
  27.  * class whose instances are intended to be executed by a thread. The 
  28.  * class must define a method of no arguments called <code>run</code>.
  29.  * <p>
  30.  * This interface is designed to provide a common protocol for objects that
  31.  * wish to execute code while they are active. For example,
  32.  * <code>Runnable</code> is implemented by class <code>Thread</code>.
  33.  * Being active simply means that a thread has been started and has not
  34.  * yet been stopped. 
  35.  * <p>
  36.  * In addition, <code>Runnable</code> provides the means for a class to be
  37.  * active while not subclassing <code>Thread</code>. A class that implements
  38.  * <code>Runnable</code> can run without subclassing <code>Thread</code>
  39.  * by instantiating a <code>Thread</code> instance and passing itself in
  40.  * as the target.  In most cases, the <code>Runnable</code> interface should
  41.  * be used if you are only planning to override the <code>run()</code>
  42.  * method and no other <code>Thread</code> methods.  
  43.  * This is important because classes should not be subclassed
  44.  * unless the programmer intends on modifying or enhancing the fundamental
  45.  * behavior of the class.
  46.  *
  47.  * @author  Arthur van Hoff
  48.  * @version 1.13, 08/25/97
  49.  * @see     java.lang.Thread
  50.  * @since   JDK1.0 * @see     Thread
  51.  */
  52. public
  53. interface Runnable {
  54.     /**
  55.      * When an object implementing interface <code>Runnable</code> is used 
  56.      * to create a thread, starting the thread causes the object's 
  57.      * <code>run</code> method to be called in that separately executing 
  58.      * thread. 
  59.      *
  60.      * @see     java.lang.Thread#run()
  61.      * @since   JDK1.0
  62.      */
  63.     public abstract void run();
  64. }
  65.