1. What is Java 8 ?

Ans: It is a major feature release of Java Programming Language.

2. What are the new features of the Java 8 ?


a. Lambda expression
b. Method references
c. Default method
d. Stream API
e. Date Time API
f. Nashorn , Javascript Engine

3. What is Lambda expression ?

Ans: Adds functional processing capability to java

4. What is the use of the method references ?

Ans: Referencing functions by their names instead of invoking them directly

5. What is default method ?

Ans: Interface to have default method implementation.

6. What is jdeps ?

Ans: It is a compiler tools which are used to figure out dependencies.

7. What is the use of the stream API ?

Ans: It is used to facilitate pipeline processing.

8. What is date time API ?

Ans: Improved date time API

9. What is Nashorn Javascript Engine ?

Ans: A java-based engine to execute javascript code.

10. What is the use of the sortusingjava8() method ?

Ans: Uses sort function with a lambda expression as parameter to get the sorting criteria.

11. What are the three popular java editors ?


1. Notepad
2. Netbeans
3. Eclipse

12. What are the important characteristics of a lambda expression ?


1. optional type declaration
2. optional parenthesis around parameter
3. optional curly braces
4. optional return keyword

13. How to represent method reference ?

Ans: It is described using “::” symbol.

14. What are the three types of method reference ?


1. Static methods
2. Instance methods
3. Constructors using new operator

15. How to compile java program ?

Ans: Command: javac program-name

16. What is Predicate interface ?

Ans: Predicate <T> interface is a functional interface with a method test (Object) to return a boolean value.

17. What is the use of the default method ?

Ans: Java 8 introduces default method so that list/collection interface can have a default implementation of foreach method and the class implementing these interfaces need not implement the same.

18. What is stream ?

Ans: Stream is a new abstract layer method introduced in java 8. It is a sequence of objects from a source which supports aggregate operations.

19. What are the two methods to generate stream ?


a. stream()
b. parallelStream()

20. What is stream() ?

Ans: Returns a sequential stream considering collection as its source.

21. What is parallelstream () ?

Ans: Returns a parallel stream considering collection as its source.

22. How to iterate each element of the stream ?

Ans: Using forEach method

23. What is map method ?

Ans: The map method is used to map each element to its corresponding result.

24. What is filter method ?

Ans: The filter method is used to eliminate elements based on a criteria.

25. What is limit method ?

Ans: The limit method is used to reduce the size of the stream.

26. What is collectors ?

Ans: Collectors are used to combine the result of processing on the elements of a stream.

27. What is the use of the collectors ?

Ans: It can be used to return a list or a string.

28. What is optional objects ?

Ans: Optional objects is a container object used to contain not-null objects.

29. What is the use of the optional objects ?

Ans: Optional object is used to represent null with absent value.

30. What is JJS ?

Ans: JJS is a new command line tool to execute javascript codes at console.

31. What is the advantage of the chrono units enum ?

Ans: It is added in java 8 to replace the integer values used in old API to represent day, month etc.

32. What is the use of the temporaladjuster ?

Ans: TemporalAdjusters is used to perform the date mathematics.

33. What is toInstant() method ?

Ans: A toInstant() method is added to the original date and calendar objects which can be used to convert them to the new date-time API.

34. What are the three types of inbuilt encoder and decoder for base64 encoding ?

Ans: There are three types of inbuilt encoder and decoder for base64 encoding

1. Simple
2. URL