0% found this document useful (0 votes)
98 views3 pages

Java 8 Features and Concepts Quiz

The document discusses various Java concepts including: - PermGen space being replaced with Metaspace in Java 8 - The test(T t) method can be overridden from the Predicate class - Pipelines end with a terminal operation - An object can be replaced with a Runnable - DateTimeFormatter example outputs a DateTimeException - Period example outputs "Period: 1" - RxJava is used for reactive programming - Lambda expressions allow treating code as data - The lambda expression adds two numbers and returns their sum - Calling the add() method example would output "Welcome lambda" - The new command-line tool for Nashorn is jjs

Uploaded by

Debarshi Roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views3 pages

Java 8 Features and Concepts Quiz

The document discusses various Java concepts including: - PermGen space being replaced with Metaspace in Java 8 - The test(T t) method can be overridden from the Predicate class - Pipelines end with a terminal operation - An object can be replaced with a Runnable - DateTimeFormatter example outputs a DateTimeException - Period example outputs "Period: 1" - RxJava is used for reactive programming - Lambda expressions allow treating code as data - The lambda expression adds two numbers and returns their sum - Calling the add() method example would output "Welcome lambda" - The new command-line tool for Nashorn is jjs

Uploaded by

Debarshi Roy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PermGen space has been replaced with which of these in Java 8?

Metaspace

Which method can be overridden from the Predicate class in Java 8?


test(T t)

Each pipeline ends with a/an ____________


Terminal operation

Object o = () -> {[Link](“Example”); };

Object o can be replaced with?

Runnable r

DateTimeFormatter dateFormat=DateTimeFormatter.ISO_DATE;
LocalDate dateOfBirth= [Link](2015,[Link],31);
[Link]([Link](dateOfBirth));

What would be the output?

Java DateTimeException

LocalDate date1 = [Link]();


LocalDate date2 = [Link](1, [Link]);
Period period = [Link](date2, date1);
[Link]("Period: " + period);

Choose the correct output.

Period: 1

The library used to write reactive programs in Java is _________


RxJava
Lambda expressions in Java allow us to treat ___________

Code as data

Which of the following is the correct lambda expression, which adds two
numbers and returns their sum?

Both the options

public interface Adder {


    String add(Function<String, String> f);
    void add(Consumer<Integer> f);
}
 
public class AdderImpl implements Adder {
 
    @Override
    public  String add(Function<String, String> f) {
        return [Link]("Welcome ");
    }
 
    @Override
    public void add(Consumer<Integer> f) {}
}

On calling add() method as described below, what will be the output?

String r = [Link](a -> a + " lambda"); [Link](r);

Runtime error

Which is the new command-line tool for the Nashorn JavaScript engine in
Java 8?
jjs

You might also like