1、用lambda表达式实现Runnable:() -> {}代码块替代了整个匿名类
() -> {}
// Java 8之前: new Thread(new Runnable() { @Override public void run() { System.out.println("Before Java8, too much code for too little to do"); } }).start(); //Java 8方式: new Thread(() -> System.out.println("In Java8, Lambda expression rocks !!")).start();