Вложенное в Java несоответствие универсального типа
В следующем примере:
public static void main(String[] args) {
List b = new ArrayList();
first(b);
second(b);
List a = new ArrayList();
third(a);
fourth(a); // doesnt work
}
private static void first(List a){
System.out.println("List of T");
}
private static void second(List a){
System.out.println("List of anything ");
}
private static void third(List a){
System.out.println("List of a List of T ");
}
private static void fourth(List a){
System.out.println("List of a List of anything ");
}
Почему вызов секунда (б) работает, а вызов четвертого (а) - нет?
Я получаю следующую ошибку:
The method fourth(List) in the type `TestTest` is not applicable for the arguments (`List`)