*
The moose likes Java in General and the fly likes Generics Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Generics Question" Watch "Generics Question" New topic
Author

Generics Question

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536

whats wrong with this? The compiler complains that it cannot instantiate the type ArrayList<? extends someAbstractClass>


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
You cannot use wildcards in constructor calls. Use

new ArrayList<someAbstractClass>()

instead.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generics Question
 
Similar Threads
Genrecis and Wildcard
Generics
Sierra/Bates, Chapter 7, Two Minute Section
Generics declaration.
Generics Question: