0 votes
in JAVA by

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;}

1 Answer

0 votes
by
Answer: c) (String s) -> System.out.println(s).

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