JAVA 8 INTERVIEW QUESTION AND ANSWER (Experienced)
Significant reason for introducing java8 was to introduce Conciseness in the code.
JAVA bring in Functional programming which is enabled by Lambda expression ( a powerful tool to create concise code base.)
Q) What are new features which got introduced in java8?
1. Lambda Expression
2.Stream API
3. Default method in the Interface
4. Static method
5. Functional Interface
6. Optional
7. Date
8. Nashron, Javascript Engine
9. Method reference
Q) What are main advantages of using Java 8?
Main advantages
Compact cod ( Less boiler plate code)
More readable and reusable code.
More testable code
Parallel operations
Q. What is Lambda Expression?
Lambda expression is an anonymous function (without name, return type and access modifier and having on lambda (->) symbol.
Q. What is Functional Interface?
Functional interfaces are those interface which can have only one abstract method.
It can have any number of static method, default method.
There are many functional interfaces already present in java such as Comparable and Runnable.
A Functional Interface can be used as a reference for Lambda expression.