A

Admin • 828.70K Points
Coach

Q. Which lambda expression syntax is valid to implement a `Consumer<String>` that prints the string?

  • (A) s -> System.out.println(s)
  • (B) (s) => print(s)
  • (C) s :> System.out.print(s)
  • (D) (s) => System.print(s)

Explanation by: Admin
`s -> System.out.println(s)` correctly implements a Consumer.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.