Which statement is true about the single abstract method of the java.util.function.Function interface?

Which statement is true about the single abstract method of the java.util.function.Function interface?
A. It accepts one argument and returns void.
B. It accepts one argument and returns boolean.
C. It accepts one argument and always produces a result of the same type as the argument.
D. It accepts an argument and produces a result of any data type.

Download Printable PDF. VALID exam to help you PASS.

10 thoughts on “Which statement is true about the single abstract method of the java.util.function.Function interface?

  1. C should be Correct

    Function
    Function f = new Function() {

    public Double apply(Integer t) {

    return t;
    }
    };

    the result will always be that of type R

  2. C is correct.
    When creating a Function you need to pass two types, first the T, and then R for the return class.
    public interface Function and R apply(T t);
    Function will become a Integer apply(String t)

    1
    1
      1. Nevermind, just read again and “a result of the same type as the argument” is incorrect. Awnser is D then.

  3. It looks like the answer for this question should be D.

    Public interface Function; R apply(T t). The function method accepts type t argument and return a generic type R, which could be any data type.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.