This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Supporting Stephan's statement my beloved outstanding book - Java 2 by Bill Brogden says on page #151 -
Now consider the following code fragment in which a Chapter object is created but the reference is cast to a BookElement variable. The question is: Which method is executed, the one in the Chapter class or the one in the Bookelement class?
The answer is related to the fact the objects always know what type they are; just being cast to a BookElement reference does not change the object type. Because the Java Virtual Machine resolves method calls at runtime using the actual object, the Chapter version of addText is executed.
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.