Further to a previous post I’m hope someone can help clarify/confirm my understanding of the following java generics statements, and offer some input as to what the final one means:
If:
Class<abc> className = x
means to assign x of type abc to Class variable className
And:
Class<? extends IAbc> className = x
means to assigns x which implements interface IAbc to Class variable className
What does:
Class<? extends IAbc<?>> className = x
mean?
That just means that
IAbcis itself a generic typeIAbc<T>, you’re asking for aClassobject representing some implementation of some parameterization ofIAbcbut you don’t know (or care?) which.More interesting would be something like
which would accept any class that implements
IAbc<Number>,IAbc<Integer>,IAbc<Double>, etc.