Given the code fragment: BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2; //line n1 //line n2 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.
Most Voted
Autounboxing is needed for the values to be added. The main point here is when we add a double to an int , double is returned . So if we had BiFunction<Integer,Double,Double> it would compile file. The answer is C
Bad return type in lambda expression: double cannot be converted to Integer in line n1 so answer C
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
jduarte
Highly Voted 3 years, 7 months agoAVB22
2 years, 9 months agoasdfjhfgjuaDCV
Most Recent 5 months, 3 weeks agosteefaand
6 months, 3 weeks agoiSnover
6 months, 3 weeks agoWilsonKKerll
2 years, 5 months agogriglad
2 years, 6 months agofffff
3 years, 6 months ago