I am trying to use a Collection, but when I try to compile, I get an error saying that the collection may not have been initialized at this line:
colData.add("Hello");
^
so how do I initialize a Collection?
Thanks
:)
Printable View
I am trying to use a Collection, but when I try to compile, I get an error saying that the collection may not have been initialized at this line:
colData.add("Hello");
^
so how do I initialize a Collection?
Thanks
:)
How did you do it in your code?
I don't think that you can do this. I may be wrong but I believe that there's only three types of collections:Code:Collection myCol = new Collection();
Sets:
- HashSet
- TreeSet
Lists:
- Vector
- Stack
- LinkedList
- ArrayList
Maps:
- HashTable
- HashMap
- WeakHashMap
- TreeMap
Chris
Thanks. I got it to work.
:)