Java OCA OCP Practice Question 2129

Question

Which of the following are functional interfaces? (select ALL that apply).

  • a . java.util.stream.stream<t>
  • B. java.util.function.Consumer<t>
  • C. java.util.function.supplier<t>
  • d. java.util.function. predicate<t>
  • e. java.util.function.Function<t, r>


B, C, d, and e

Note

the interface java.util.stream.Stream<T> is not a functional interface-it has numerous abstract methods. the other four options are functional interfaces.

the functional interface java.util.function.Consumer<T> has an abstract method with the signature void accept(T t);

the functional interface java.util.function.Supplier<T> has an abstract method with the signature T get();

the functional interface java.util.function.Predicate<T> has an abstract method with the signature boolean test(T t);

the functional interface java.util.function.Function<T, R> has an abstract method with the signature R apply(T t);




PreviousNext

Related