What does this program print?

from Generics
Java 25 LTS intermediate 2 min

What does this program print?

Java
import java.util.ArrayList;
import java.util.List;

public class Main {
    static <T> void copy(
            List<? super T> destination,
            List<? extends T> source) {
        destination.addAll(source);
    }

    public static void main(String[] args) {
        List<Integer> source = List.of(2, 4);
        List<Number> destination = new ArrayList<>(List.of(1.5));
        copy(destination, source);
        System.out.println(destination);
    }
}
Open in playground
Report an error