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

Popular posts from this blog

How to create React project using command prompt?

How to achieve abstraction?

Interview Question? How to find square of each element in this Array {2,4,5,6,8} using map ?