Java Basic


  1. What does SAM stand for in the context of Functional Interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    SAM Interface stands for Single Abstract Method Interface. Functional Interface is also known as SAM Interface because it contains only one abstract method.


  1. What is the substitute of Rhino javascript engine in Java 8?











  1. 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.



  1. What is Optional object used for?











  1. 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.


  1. What does Files.lines(Path path) do?











  1. 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.



  1. Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?











  1. 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.