I know that there are milions of video tutorials on this and I have watched many of them. However, I still don't understand one thing about polymorphism and I was hoping that someone from here would be able to make it clear for me.
I have a class called Animal and a class called Dog which extends Animal. The Animal class has one method called makeNoise
and Dog class overrides it. Now, what is the difference between declaring the Dog object this way:
Dog myDog = new Dog();
And:
Animal myDog = new Dog();
I know this is most likely a duplicate but I really want to understand this and was not able to do so from the resources that already exist.