(paramters) -> {statements;}
展开如:
(Type1 param1, Type2 param2, Type2 param2, …) -> {
statement1;
statement2;
statement3;
…
return statementX;
}
1、//匿名内部类写法
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("内部类");
}
}).start();
2、//lambda 写法
new Thread(() -> System.out.println("lambda")).start();