Lambda Expression without types
问题 I understand the syntax of the Java8 lambda expressions but why does the following code work without a specific type declaration of x? Why is "baz" being printed? public class LambdaExpressions { interface Foo { void bar(Object o); } static void doo(Foo f) { f.bar("baz"); } public static void main(String[] args) { doo( x -> {System.out.println(x);}); } } 回答1: Since the interface is a standard functional interface It's a functional interface because it contains only one abstract method. This