Runnable vs thread
- how to use runnable in java
- how to use runnable interface in java
- how to start runnable thread in java
- how to use run method in java
Runnable thread in java.
The class must define a method of no arguments called .
This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example, is implemented by class . Being active simply means that a thread has been started and has not yet been stopped.
Java runnable lambda
In addition, provides the means for a class to be active while not subclassing . A class that implements can run without subclassing by instantiating a instance and passing itself in as the target. In most cases, the interface should be used if you are only planning to override the method and no other methods.
This is important because classes should not be subclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class.
- Since:
- JDK1.0
- See Also:
- ,
- what is runnable in java
- runnable java example