What is the type of `x -> x.toUpperCase()` if x is a String?

  1. Predicate<String>
  2. Function<String, String>
  3. Consumer<String>
  4. Supplier<String>
Correct answer Function<String, String>

Explanation

It takes a String input and returns a String output, which is a Function.

Update: Admin added a tag on this question

Topics

By Admin · · 26 views