Why can we not use default methods in lambda expressions?
问题 I was reading this tutorial on Java 8 where the writer showed the code: interface Formula { double calculate(int a); default double sqrt(int a) { return Math.sqrt(a); } } And then said Default methods cannot be accessed from within lambda expressions. The following code does not compile: Formula formula = (a) -> sqrt( a * 100); But he did not explain why it is not possible. I ran the code, and it gave an error, incompatible types: Formula is not a functional interface` So why is it not