A

Admin • 825.56K Points
Coach

Q. Which of the following is not a valid lambda expression in Java 8?

  • (A) (int x, int y) -> x + y
  • (B) () -> “Hello, World!”
  • (C) (String s) -> System.out.println(s)
  • (D) (int x) -> {return x*x;}
  • Correct Answer - Option(C)
  • Views: 3
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
This lambda expression does not return a value, which violates the functional interface contract.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.