What is the result?

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?
A. 20
B. 20.5
C. A compilation error occurs at line n1.
D. A compilation error occurs at line n2.

Download Printable PDF. VALID exam to help you PASS.

5 thoughts on “What is the result?

  1. return value is Integer so need to change to IntValue()
    then it will compile and result would be 20
    BiFunction val = (t1, t2) -> t1.intValue() + t2.intValue(); // line n1

    but in that case answer is C

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.