Java OCA OCP Practice Question 1641

Question

Fill in the blanks:

The ___ functional interface does not take any inputs,

while the ___ functional interface does not return any data.

  • A. IntConsumer, LongSupplier
  • B. IntSupplier, Function
  • C. Supplier, DoubleConsumer
  • D. UnaryOperator, Consumer


C.

Note

The Supplier functional interface does not take any inputs, while the Consumer functional interface does not return any data.

This behavior extends to the primitive versions of the functional interfaces, making Option C the correct answer.

Option A is incorrect because IntConsumer takes a value, while LongSupplier returns a value.

Options B and D are incorrect because Function and UnaryOperator both take an input and produce a value.




PreviousNext

Related