LogiQuest
Back to Java 8 Features
12

What is the output of the following program?

public class Main {
    public static void main(String[] args) {
        java.util.function.Function<Integer, Integer> add1 = x -> x + 1;
        java.util.function.Function<Integer, Integer> dbl = x -> x * 2;
        System.out.println(add1.andThen(dbl).apply(5));
    }
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.