What is the syntax and characteristics of a Lambda Expression? Explain
The syntax for the Lambda expression is:-
parameter -> expression body
- No need to declare the parameter type as the compiler will get the standard by the value of the parameter.
- For the multiple parameters parenthesis has to be declared, but for the simple parameter, parenthesis need not be declared.
- If a contains only a single parameter, then there is no need of curly braces.
This is a very critical question in Java 8 interview questions.