Hello all, this is my first post on
Java Ranch. I have a very small doubt, regarding Java wildcards.
I am going through the following documentation on wildcards :
Javadocs
All's clear but for a certain piece of code :
Here as per the author, the type of c is unknown, hence a new Object cannot be added to it, since the type is not known. But, as per first line of this code, the collection refers to an ArrayList of Strings.
Hence, isn't the type
String defined for the Collection c. If not, what does line 1 infers to?
I would appreciate help on this. Thanks.