• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generic type T

 
P Ventura
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the following code legal?
 
Kelvin Chenhao Lim
Ranch Hand
Posts: 513
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the argument syntax is incorrect. The "<? extends T>" wildcard syntax only applies if you're providing it as a type parameter for another generic class, e.g.



However, what you probably intended to do was simply this:



As per the usual rules of polymorphism, any object that's a subclass of T will be permitted wherever a T parameter is required.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic