When overriding method i return type a subtype of the super method return type. But why i can't do the same thing with the method parameter list.
Ex.
public class OverrideTest implements CustomersI {
@Override
public ArrayList<Customer> getCustomers(ArrayList<String> names) {
// TODO Auto-generated method stub
return null;
}
}
interface CustomersI{
List<Customer> getCustomers(List<String> names);
}
class Customer{
Customer(String name){
}
}
- why i can change return type ArrayList instead of List and can't do the same with param list.