Skip to content

Why List of String is not a List of Object

String is a subtype of Object, yet this does not compile:

java List<Object> objects = new ArrayList<String>();

Why is it rejected?