来自Joshua Bloch的Effective Java,
协变简单地意味着如果X是Y的子类型,那么X[]也将是Y[]的子类型。数组是协变的,因为字符串是对象的子类型,所以
String[] is subtype of Object[]
不变量简单地意味着不考虑X是否是Y的子类型,
List<X> will not be subType of List<Y>.
My question is why the decision to make arrays covariant in Java? There are other SO posts such as Why are Arrays invariant, but Lists covariant?, but they seem to be focussed on Scala and I am not able to follow.