Java Basic
- What are the two types of Streams offered by java 8?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Sequential stream and parallel stream are two types of stream provided by java.
- What is Optional object used for?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Optional object is used to represent null with absent value. This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values.
- What does Files.lines(Path path) do?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Files.lines(Path path) that reads all lines from a file as a Stream.
- Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Executors newWorkStealingPool() method to create a work-stealing thread pool using all available processors as its target parallelism level.
- What is the substitute of Rhino javascript engine in Java 8?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Nashorn provides 2 to 10 times faster in terms of performance, as it directly compiles the code in memory and passes the bytecode to JVM. Nashorn uses invoke dynamic feature.