源码展示
package java.lang;
/**
* The Runnable interface should be implemented by any
* class whose instances are intended to be executed by a thread.
*/
@FunctionalInterface
public interface Runnable {
/**
* When an object implementing interface Runnable is used
* to create a thread, starting the thread causes the object's
* run() method to be called in that separately executing thread.
*/
public abstract void run();
}
示例
public class Test {
public static void main(String args[]) {
new Thread(()->{
System.out.println("Runnable 的 lambda 写法!");
}).start();
}
}
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。