This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes In generics what is mean by <E> <T> <? extends >? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "In generics what is mean by <E> <T> <? extends >?" Watch "In generics what is mean by <E> <T> <? extends >?" New topic
Author

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

lakmal padmakumara
Ranch Hand

Joined: Aug 08, 2009
Posts: 47
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 !


[Bsc in Computer Science and Engineering] [SCJP 80%][BCS certificate level]
Nicolas Kal
Ranch Hand

Joined: Sep 09, 2009
Posts: 69
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


SCJP 6.0 , SBCD (Preparing..),
MSc Enterprise Systems Development, BSc Computer Science
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: In generics what is mean by <E> <T> <? extends >?
 
Similar Threads
Namma Suvarna Maharashtra -Arjun
Spec Page 48
Externalizable interface
Struts application to run with IIS
Problem in passing color as a parameter