= Solution
Immutable Scala \b[`List[+A]` is covariant]: if `Juice` is a subtype of `Drink`, a list of juices can be used as a list of drinks. Scala \b[`Array[A]` is invariant] because it permits both reading and writing elements.
If an array of juices could be treated as an array of drinks, writing a beer through that widened reference would violate the original juice-array contract. This illustrates <covariant type parameter> versus <generic type invariance>; immutability permits the first relationship for lists.
Back to article page