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
When you do this: Animal animal = new Dog(); it's upcasting.
Animal animal = new Dog();
And you do not override the method
public void eat(Flesh flesh){ System.out.println("Dog eats "+ flesh); }
so it calls the method eat(Food food) of Animal
eat(Food food)
Animal