Why can't I add the parent class in the wildcard container?

public class User {

}
public class Child extends User {

}

import java.util.LinkedList;

public class Test {
    public static void main(String[] args) {
        LinkedList<? super Child> linkedList = new LinkedList<>();
        linkedList.add(new Child());
        linkedList.add(new User());
      /**
         * User
         * The method add(capture-sharp2-of ? super Child) in the type LinkedList<capture-sharp2-of ? super Child> is not applicable for the arguments (User)
         */
    }
}
Mar.16,2021

? super Child:ChildChildChildadd

can only be a subclass of add Child or Child, because a subclass of Child must also be of Child type.

Menu