In Java geschachtelte generische Typenkonflikte

Im folgenden Beispiel:

public static void main(String[] args) {

    List<String> b = new ArrayList<String>();
    first(b);
    second(b);

    List<List<String>> a = new ArrayList<List<String>>();
    third(a);
    fourth(a);  // doesnt work

}

private static <T> void first(List<T> a){
    System.out.println("List of T");
}

private static void second(List<?> a){
    System.out.println("List of anything ");
}

private static <T> void third(List<List<T>> a){
    System.out.println("List of a List of T ");
}

private static void fourth(List<List<?>> a){
    System.out.println("List of a List of anything ");
}

Warum funktioniert der Aufruf von second (b), der Aufruf von fourth (a) jedoch nicht? ?

Ich erhalte folgenden Fehler:

The method fourth(List<List<?>>) in the type `TestTest` is not applicable for the arguments (`List<List<String>>`)

Antworten auf die Frage(5)

Ihre Antwort auf die Frage