This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics

 
Juan Manuel Alberto de los Santos
Ranch Hand
Posts: 48
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic