File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Head First Android this week in the Android 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

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

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


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

Joined: Oct 13, 2005
Posts: 43392
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.
I agree. Here's the link:
subject: In generics what is mean by <E> <T> <? extends >?
It's not a secret anymore!