I was reviewing someone else's code the other day and I came across a line that raised some concern. To simplify, say I have a generic Class A and an abstract Class B. Is the following instantiation allowed and if so, why?
Object obj = new A<? extends B>();
I personally have never seen an instantiation like the above, although a declaration such as
A<? extends B> obj = null;
would certainly hold. I've always used the wildcard in generics to declare method parameters, so I may just not have the experience.