posted 18 years ago
? extends Number can store not only Integer, but also Long, Double etc.
So if the compiler is allowing
for(Integer n: type)
then it will fail at run time if the object reference variable points to Long or Double.
So inorder to avoid this situation , compiler is showing the error as incompatible types.