1. /*
  2. * @(#)Runnable.java 1.21 00/02/02
  3. *
  4. * Copyright 1994-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.lang;
  11. /**
  12. * The <code>Runnable</code> interface should be implemented by any
  13. * class whose instances are intended to be executed by a thread. The
  14. * class must define a method of no arguments called <code>run</code>.
  15. * <p>
  16. * This interface is designed to provide a common protocol for objects that
  17. * wish to execute code while they are active. For example,
  18. * <code>Runnable</code> is implemented by class <code>Thread</code>.
  19. * Being active simply means that a thread has been started and has not
  20. * yet been stopped.
  21. * <p>
  22. * In addition, <code>Runnable</code> provides the means for a class to be
  23. * active while not subclassing <code>Thread</code>. A class that implements
  24. * <code>Runnable</code> can run without subclassing <code>Thread</code>
  25. * by instantiating a <code>Thread</code> instance and passing itself in
  26. * as the target. In most cases, the <code>Runnable</code> interface should
  27. * be used if you are only planning to override the <code>run()</code>
  28. * method and no other <code>Thread</code> methods.
  29. * This is important because classes should not be subclassed
  30. * unless the programmer intends on modifying or enhancing the fundamental
  31. * behavior of the class.
  32. *
  33. * @author Arthur van Hoff
  34. * @version 1.21, 02/02/00
  35. * @see java.lang.Thread
  36. * @since JDK1.0
  37. */
  38. public
  39. interface Runnable {
  40. /**
  41. * When an object implementing interface <code>Runnable</code> is used
  42. * to create a thread, starting the thread causes the object's
  43. * <code>run</code> method to be called in that separately executing
  44. * thread.
  45. * <p>
  46. * The general contract of the method <code>run</code> is that it may
  47. * take any action whatsoever.
  48. *
  49. * @see java.lang.Thread#run()
  50. */
  51. public abstract void run();
  52. }