Jdk 1.5
I am copying a small snippet from generics..
static void fromArrayToCollection(Object[] a, Collection<?> c) {
for (Object o : a) {
c.add(o); // Compile time error
}
}
Rule 1
In the tutorial they are saying that "We can call this method with any kind of collection whose element type is a supertype of the element type of the array."
Rule 2
But In the same tutorial they are saying that Collection<Object> will not accept a <String > since both are different ....
I am totally confused about the two statements. How does the first code snippet confirms to rule 2?

