Harikrishna Gorrepati wrote:Hi, Why can't I do this? Error is in the comments.
It is not an override, because the super class add method takes an E instance as it's it parameter -- and in your example, it takes a Person object. So, technically, it should be a overload, one for Person and one for Object.
Unfortunately, it can't be an overload either. Because of type erasure, both methods come out to the same signature.