+2 votes
in JAVA by
public interface Adder {

    String add(Function<String, String> f);

    void add(Consumer<Integer> f);

}

 

public class AdderImpl implements Adder {

 

    @Override

    public  String add(Function<String, String> f) {

        return f.apply("Welcome ");

    }

 

    @Override

    public void add(Consumer<Integer> f) {}

}

On calling add() method as described below, what will be the output?

String r = adderImpl.add(a -> a + " lambda"); System.out.println(r);

Prints "Welcome lambda"

Prints "Lambda"

Compilation error

Runtime error

Related questions

0 votes
asked Mar 16, 2021 in JAVA by Robindeniel
+1 vote
asked Dec 16, 2020 in JAVA by SakshiSharma
...