Lambda casting rules
问题 I was curious why a lambda with a return type can not be casted to a Runnable whereas a non void method reference can. Runnable r1 = () -> 1; // not allowed // error: incompatible types: bad return type in lambda expression // int cannot be converted to void Runnable r2 = ((Supplier)() -> 1)::get; // allowed 回答1: The Runnable interface defines the run method with return type void. In a lambda expression that means that the part following the arrow -> must be a statement . This is explained in