Java SE 11 Developer — Question 18

Which interface in the java.util.function package can return a primitive type?

Answer options

Correct answer: A

Explanation

The ToDoubleFunction interface is specifically designed to return a double primitive type, making it the correct choice. The Supplier interface does not return a primitive type but an object, while BiFunction also returns an object type and not a primitive. LongConsumer is used for operations on a long value but does not return any value.