<?> vs <? extends Object>

Discussion in 'Java' started by Murat Tasan, Jul 6, 2005.

  1. Murat Tasan

    Murat Tasan Guest

    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.
     
    Murat Tasan, Jul 6, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Skeet
    Replies:
    5
    Views:
    2,160
    Dale King
    Jul 8, 2003
  2. Replies:
    4
    Views:
    341
    Roedy Green
    Nov 24, 2005
  3. SD
    Replies:
    2
    Views:
    8,062
    Roedy Green
    May 22, 2006
  4. odwl
    Replies:
    1
    Views:
    12,218
    Thomas Hawtin
    Jun 15, 2006
  5. wilq
    Replies:
    38
    Views:
    266
Loading...

Share This Page