Which method has to be called is decided during run time and not compile time. During compile time, the compiler only sees the reference variable which it is associated to.
Basic rule if the method called is overridden contents of the object decide which method is going to be called.
if the method is not overridden, then type of the object decides which method is called.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton