P

Pushkar • 380 Points
Valuable

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: 247
  • Filed under category JAVA

Explanation by: Pushkar
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.


Question analytics