CHAPTER 20: The Package java.lang Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

20.19 The Interface java.lang.Runnable

20.19.1 run

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();
}


20.19.1 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.