You will get a runtime ArrayStoreException on line 2. This is pretty similar to what you're trying to do with generics only with generics the compiler will catch the exception in compile time and will not let you do it.
If you change line 2 to:
You will no longer get a runtime error. Same thing for if you try to add A to your ArrayList. The reason, i assume and I hope people will correct me if i'm wrong, is that the underlying type of the ArrayList is a A and that's the only type you can add to the list because "?" is a runtime placeholder so basically Java can't know what you'll put in there but it will know that any thing that comes out of the list when you "get" it will be an A.
We can interpret ArrayList<? super B> to mean that the list contains elements only of some specific unknown type, but we do know that the type is either B or a superclass of B. An ArrayList<A> would fit, but so would an ArrayList<B>. Therefore you could have written this for line 1 instead:
In this case, it's clearer why line 2 fails -- it's trying to put something that's not a B into a list of B's. It fails to compile in your original example because the compiler doesn't really know exactly what the specific type of l2 is, so it behaves pessimistically.
Inquisition: open-source mock exam simulator for SCJP and SCWCD