All,
I dont understand why the compiler doesn't give error for the following statement.
List<? extends
String> list1 = new ArrayList<String>();
We know that String is a final class and you cannot subclass it. So why doesnt the compiler mark the statement "? extends String" as error?
In my opinion the only reason for not giving error is because it can contain String objects as well which can be valid. Please correct me if I am wrong.
Thank you,
Rohit.