Skip to content
Quiz · Lambdas and the Stream API · lesson 4 of 12

Quiz — andThen

What does the program print?

JAVA
import java.util.function.Function;

public class Main {
    public static void main(String[] args) {
        Function<Integer, Integer> f = x -> x + 1;
        Function<Integer, Integer> g = x -> x * 2;
        System.out.println(f.andThen(g).apply(3));
    }
}