aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Creating own generic types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Creating own generic types" Watch "Creating own generic types" New topic
Author

Creating own generic types

Maheswaran Devaraj
Ranch Hand

Joined: Sep 14, 2007
Posts: 47
Hi friends,



can we use super keyword instead of extends in the line 1.

Thanks in advance,
Mahes
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14826
    
  26

What happened when you tried? What do you think it would mean if you would use 'super' instead of 'extends' there?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Deepak Giri
Ranch Hand

Joined: Feb 12, 2009
Posts: 52
Hi Maheswaran!

well, you can use super but for that you got to have a reason ( i mean you got to have some superclass which is extended or implemented by Animal directly or indirectly)..

if you replace the extends word with super in line 1 here, then you cannot declare an AnimalHolder reference (here, in line 4) which is of the type Dog, because Dog is not the supertype of Animal


SCJP
 
Don't get me started about those stupid light bulbs.
 
subject: Creating own generic types