Which statements are true about the following code?
class SupX {/*from w w w . j a va 2s . c om*/ public void set(Collection<?> c) {/*...*/} // (1) } class SubX extends SupX { public void set(List<?> l) {/*...*/} // (2) public void set(Collection c) {/*...*/} // (3) } //------------------------------------------ class SupY { public void set(Collection c) {/*...*/} // (4) } class SubY extends SupY { public void set(Collection<?> c) {/*...*/} // (5) }
Select the three correct answers.
(a), (e), and (i)
The erasure of the signature of (2) is different from the erasure of the signature of (1), i.e., overloaded, since signatures are not override-equivalent.
Therefore, of the three alternatives (a), (b), and (c), only (a) is correct.
The signature of (3) is the same as the erasure of the signature of (1), i.e., overridden.
Therefore, of the three alternatives (d), (e), and (f), only (e) is correct.
The erasure of the signature of (5) is the same as the signature of (4), and not the other way around, i.e., name clash.
Therefore, of the three alternatives (h), (i), and (j), only (i) is correct.