CHAPTER 20: The Package java.lang |
![]() Previous |
![]() Java Language |
![]() Index |
![]() Next |
The Runnable interface should be implemented by any class whose instances are intended to be executed by a new thread. All that is required of such a class is that it implement a method of no arguments called run.
public interface Runnable { public abstract void run(); }
public abstract void run()
The general contract of the method run is that it may take any action whatsoever.
If an object implementing interface Runnable is used to create a thread (S20.20), then starting the thread will (normally) lead to the invocation of the object's run method in that separately executing thread.
© 1996 Sun Microsystems, Inc. All rights reserved.