As per the rule, while overriding a method in subclass, parameters cannot be changed and have to be the same as in the super class. What if we pass subclass of parameter wh
No, we can not in this case you can check it by adding @Override above the eat method in Dog class so compilation error will appear like this :
@Override
public void eat(Flesh flesh){
System.out.println("Dog eats "+ flesh);
}
Make sure that in override the parameters should be as parent class in type and order.