Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Can't customed generic mehtod use "super"?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Don't customed generic mehtod use "super"? Such as,
public <E super Animal> int getAinmalNum(List<E>)
,Is preceding customed generic method wrong only as the "super";
help help me,I will be happy to take your advance!
[ August 30, 2007: Message edited by: pusong lu ]
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No.

super works only with a wildcard.

<E super MyClass> bad
<? super MyClass> ok


Yours,
Bu.
 
pusong lu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public <E extends Animal> int getAinmalNum(List<E>)
is it ok?
[ August 30, 2007: Message edited by: pusong lu ]
 
pusong lu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Burkhard Hassel
<E super Myclass> is it bad or wrong ?
and <E extends Myclass>?
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


<E super Myclass> is it bad or wrong ?
and <E extends Myclass>?



<E super Myclass> does not compile
<E extends Myclass> does compile

Bu.
 
reply
    Bookmark Topic Watch Topic
  • New Topic