Java SE 8 Programmer II — Question 71

Given the code fragment:
List<Double> doubles = Arrays.asList (100.12, 200.32);
DoubleFunction funD = d ""> d + 100.0;
doubles.stream (). forEach (funD); // line n1 doubles.stream(). forEach(e ""> System.out.println(e)); // line n2
What is the result?

Answer options

Correct answer: A

Explanation

The correct answer is A because the lambda expression used in 'forEach' at line n2 is not properly defined, leading to a compilation error. The other options suggest correct execution or expected outputs, which do not occur due to the error present in the code.