File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics

 
Juan Manuel Alberto de los Santos
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Why this compiles ??

if i am passing an object(animal) to the method go (who can only accept integers)

Thanks in advance !
[ July 09, 2008: Message edited by: Juan Manuel Alberto de los Santos ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It compiles so generics are compatable with legacy code. However, you will have seen a warning:

Type safety: The expression of type List needs unchecked conversion to conform to List<Integer>

letting you know what you are doing is not necessarily safe.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic