• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

In generics what is mean by <E> <T> <? extends >?

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Explain these three occasions with a small example ?Or if you can please explain it literally .I'm having some trouble to read and understand a code ,because these signs are every where .Im checking sun tutorials also ,But I know It will help me ia lot if you can describe with your own words ! Please help !
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lakmal,

List<Base1> : A list that holds elements of type Base1
List<T extends Base1> : A list that holds elements that are either of type Base1 or they extends Base1.class

When applied to class:
In the following abstract class there are two infer types, notice that the H extends Model is used and that the H is used in the abstract class



When a concrete class extends the abstract class the H will be "replaced" by the Hotel class



It is a good design aproach when you have to deal with common functionalities but you have to work with different implementations

Regards,
Nicolas
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Google for Angelika Langer Java Generics FAQ; Angelika Langer's website is an excellent resource, but it has some things on not easy to understand. There is a good chance there will be a question just like what you asked.
reply
    Bookmark Topic Watch Topic
  • New Topic