This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes meaning of 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 » Beginning Java
Bookmark "meaning of "?" in list" Watch "meaning of "?" in list" New topic
Author

meaning of "?" in list

Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

as we know
List <Integer> list= new ArrayList<Integer>();
can contain only a list of Integers.

then what is the meaning and use of
List <?> list= new ArrayList<Integer>();
what is the use of "?" symbol in this?


thanks
Tanu Gulati
rakesh sugirtharaj
Ranch Hand

Joined: Dec 16, 2007
Posts: 151
It means a list of <<Anything>>. It is called as a wild card. The super class to all Generic collections is not Collection<Object> but a Collection<?>.May be this link could help you understand better.


Cheers!
RSR
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: meaning of "?" in list
 
Similar Threads
what is the use of ..
how to add an array to an ArrayList
List interface in Collection Framework
S&B 1.5, Chapter 7, Question 2, answer C
Error: Generics are not supported in -source 1.4