Given the code fragment:
Which code fragment, when inserted at line 7, enables printing 100?
Given the code fragment:
Which code fragment, when inserted at line 7, enables printing 100?
To print 100, a function needs to be defined that takes the integer value 90 and adds 10 to it. The code must correctly use lambda expressions and the appropriate functional interface to perform this operation. The correct method signature and function type is `ToIntFunction<Integer>`, which is designed to apply lambda expressions involving conversion to primitive int. The resulting integer must then be passed to the `accept` method of the `IntConsumer`. Therefore, the appropriate code fragment is `ToIntFunction<Integer> funRef = e -> e + 10; int result = funRef.applyAsInt(value);`.
Answer C.Tested
The correct answer is C
C,tested
C is answer.
C is correct, tested
Answer is C. A should write Function<Integer, Integer> funRef2 = e -> e + 10;