Java SE 8 Programmer II — Question 5

Given the code fragment:
BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2; //line n1
System.out.println(val.apply(10, 10.5));
What is the result?

Answer options

Correct answer: C

Explanation

The correct answer is C because the lambda expression attempts to add an Integer and a Double, which results in a compilation error due to type incompatibility. Options A and B are incorrect as they suggest valid numerical results, while option D incorrectly states that an error occurs at line n2.