• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Generics Doubt

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

I am most of the time confusing generics( where wild characters are used)

can anyone help me to get clean idea about the generic topic.any tutorial on generics please.i am reading from K&B from still i am unable to understand

Regards
Srinibash
 
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi !!!
These links could be of interest for Generics:

Angelika Langer - Java Generics FAQs

Generics in the Java Programming Language

Hope it's help.
 
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When generic code(because introducd later) is used with legacy code,
programmer has to take care if generic-based method with arguments is being passed arguments of same Generic-type .
like void method(List <Animal> a)
In this case ,caller method cant pass List<Dog> to it,when Dog is subclass of Animal.
Inheritance relation doesnt apply to generic type,

In nongenerics,we can do this.

so to remove such condtion,specially when our new code(generics) had to work with legacy code ,wildcards are used.
Remember ->wildcards means anything.
so List<?> means any list can be passed.
then we have bounded wildcards with some limits.

hope it helps
 
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic