What is the difference between Class<?>
and Class<Object>
in Java? AFAIK Java Erasure changes <?>
to it's upper bound, which in this case would be Object
anyway. So what is this for?
the difference is that Collection<String>
is not a subtype of Collection<Object>
, Collection<?>
is usable in place as an argument where any collection can be put
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With