Question: Let's say I have two classes `A` and `B` which extends `A`. With the following method I can print a `Collection` of `A` or something extending `A`:

```
private static void print(Collection<? extends A> collection) {

    for (A element : collection) {
        System.out.println(element);
    }

}

```

It's great, I can do something like:

```
public static void main(String[] args) {

    List<A> l1 = new ArrayList<>();
    l1.add(new A());
    l1.add(new B());
    print(l1);

    List<B> l2 = new ArrayList<>();
    l2.add(new B());
    l2.add(new B());
    print(l2);

}

```

Now my question is why in my method `main` (or somewhere else) I can write this

```
List<? extends A> l3 = new ArrayList<>();

```

but not this

```
l3.add(new A());
l3.add(new B());

```

I do understand why I can not add an instance of `A` or `B` in `l3`. But why the first statement which seems useless is authorized ?

**EDIT**

I ask with another words because I think my question is misunderstood.

What can I do with my empty list `List<? extends A> l3 = new ArrayList<>();` ? I know it's not possible to add anything because the type of the list is unknown.

Answer: 
`List<? extends A> l3` means that `l3` *might be* a `List<A>` or it *might be* a `List<B>`. `<? extends A>` means the compiler doesn't know and cannot safely assume any more than that.

Since it *might be* `List<B>`, `l3.add(new A())` is not safe. The List would be corrupt, since it would not truly contain only instances of B.
Generics aren't covariant and "? extends A" is not A. So you can't do:

```
List<? extends A> l = new ArrayList<>();
l.add(new A());

```

for the same reasons you can't do:

```
List<B> l = new ArrayList<>();
l.add(new A());

```

nor:

```
List<String> l = new ArrayList<>();
l.add(new Object());

```