Results 1 to 8 of 8
Thread: doubt regarding <type parameter>
- 03-01-2011, 02:39 PM #1
Senior Member
- Join Date
- Jan 2011
- Location
- Bangalore, India
- Posts
- 102
- Rep Power
- 0
doubt regarding <type parameter>
I am familiar with Objects as type parameters, for example
ArrayList<String, Integer>
TreeSet<Object>
But now I encountered a code like shown below
What does <E extends Animal> type means? Is the type having properties of both E and Animal as in the case of normal inhertiance?Java Code:interface Dog<E extends Animal>
- 03-01-2011, 02:59 PM #2
It is generic. It mean that you can use a all class, which extends Animal. and it all.
Skype: petrarsentev
http://TrackStudio.com
- 03-01-2011, 03:03 PM #3
Senior Member
- Join Date
- Jan 2011
- Location
- Bangalore, India
- Posts
- 102
- Rep Power
- 0
Is it ALL classes which extends Animal or Class E and Animal alone?you can use a all class, which extends Animal
- 03-01-2011, 03:06 PM #4
- 03-01-2011, 03:20 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Try the generics tutorial.
- 03-01-2011, 03:24 PM #6
Senior Member
- Join Date
- Jan 2011
- Location
- Bangalore, India
- Posts
- 102
- Rep Power
- 0
Thanks Troll,
I was confused with E. Even when I googled generics I could see lot of "E"s.;)
I'll make this thread SOLVED.
- 03-01-2011, 03:30 PM #7
- 03-01-2011, 03:35 PM #8
Senior Member
- Join Date
- Jan 2011
- Location
- Bangalore, India
- Posts
- 102
- Rep Power
- 0
Similar Threads
-
Subclass name to be a parameter?
By Peetahzee in forum New To JavaReplies: 6Last Post: 12-12-2009, 03:51 PM -
using instanceof to get Object type and parent type?
By xcallmejudasx in forum New To JavaReplies: 2Last Post: 11-06-2008, 06:24 PM -
[SOLVED] Cast string type to int type
By GilaMonster in forum New To JavaReplies: 9Last Post: 09-17-2008, 10:43 AM -
Retrieving a parameter through URL.
By hisouka in forum Java ServletReplies: 1Last Post: 09-06-2008, 12:45 PM -
passing an enum type as a parameter ??!
By SCS17 in forum New To JavaReplies: 11Last Post: 07-13-2008, 01:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
.gif)

Bookmarks