<?> vs <? extends Object>

M

Murat Tasan

what is the primary difference (other than clarity) between using these
two method declarations?

public void myMethod(Set<?> x);

public void myMethod(Set<? extends Object> x);

basically, during compile time, does every <?> get replaced with <?
extends X> where X is the upper bound found for the appropriate
class/interface reference?

i would think so, but i have seen some compilation warnings and errors
that have planted doubt in my mind.

unfortunately, i am having great difficulty in finding the appropriate
documentation regarding this... and i just don't have the time to
experiment enough to decode the differences.

thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top