Can I write Lambda expressions for any Interface ?
Accenture Interview Question for 3+
Q. Can I write Lambda Expression for any Interface?
Ans :- Yes, you can use lambda expressions in java for any interface that has only one abstract method. Such interfaces are known as functional interfaces, and lambda expressions provide a concise way to implement the abstract method of a function Interface
And we use “@FunctionalInterface” annotation for functional Interface.
Comments
Post a Comment