Why java wont allow this over-riding? Is there something that I am missing?
class Abc
{
public void add (List<String> li)
{
}
}
public class Test extends Abc {
public static void main(String args[])
{
}
@Override
public void add (List<Object> li)
{
}
While it does allow the method to override if I remove the
<Object>
and just write List li in the over riding method which is actually the same as
List<Object>
Also to add, it allows over-riding if both the List in over-ridden and over-riding method have same type.
List<String> - over-ridden method
List<String> - over-riding method