public class App {
public static void main(String[] args) {
User user = () -> System.out.println("hello");
user.test();
}
}
@FunctionalInterface // 函数式接口
interface User {
void test();
}
打印结果:hello
public class App {
public static void main(String[] args) {
User user = () -> System.out.println("hello");
user.test();
}
}
@FunctionalInterface // 函数式接口
interface User {
void test();
}
打印结果:hello