0 votes
in JAVA by
What is the difference between a consumer and a supplier in Java 8?

a) A consumer takes one argument and returns a value, while a supplier takes no arguments and returns a value.

b) A consumer takes no arguments and returns a value, while a supplier takes one argument and returns a value.

c) A consumer takes one argument and returns no value, while a supplier takes no arguments and returns a value.

d) A consumer takes no arguments and returns no value, while a supplier takes one argument and returns a value.

1 Answer

0 votes
by
Answer: c) A consumer takes one argument and returns no value, while a supplier takes no arguments and returns a value.

Explanation: A consumer represents an operation that takes an input and performs a side-effect, while a supplier represents an operation that produces a value.
...