函数式接口作为方法的参数
package it.com.cc.sixtween;
public class MyInterfaceDemo {
public static void main(String[] args) {
startThread(new Runnable() {
@Override
public void run() {
System.out.println(Thread.currentThread().getName()+"线程启动了");
}
});
startThread(() -> System.out.println(Thread.currentThread().getName()+"线程启动了"));
}
private static void startThread(Runnable r){
new Thread(r).start();
}
}