- All Superinterfaces:
Runnable, Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
该接口旨在为希望在活动时执行代码的对象提供通用协议
例如,Runnable 是由类 Thread 实现的,处于活动状态仅意味着线程已启动且尚未停止
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
default void
当使用实现接口 Runnable 的对象来创建线程时,
启动线程会导致在该单独执行的线程中调用对象的 run 方法
void
当使用实现接口 Runnable 的对象来创建线程时,
启动线程会导致在该单独执行的线程中调用对象的 run 方法
-
Method Details
-
multi
执行参数操作
- Parameters:
args - 参数信息
- Returns:
- the object
-
running
当使用实现接口 Runnable 的对象来创建线程时,
启动线程会导致在该单独执行的线程中调用对象的 run 方法
- Throws:
Exception - 包装的检查异常
-
run
default void run()
当使用实现接口 Runnable 的对象来创建线程时,
启动线程会导致在该单独执行的线程中调用对象的 run 方法
- Specified by:
run in interface Runnable