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

What are POJO classes in spring? What is the use of POJO Class, and How to create POJO classes.

How to create React project using command prompt?