Hi,
I'm reading OCP Oracle Certified Professional Java 17 SE Developer Study Guide, and I'm struggling to understand the following:
On page 399 (Chapter 7 Beyond Classes > Understanding
Polymorphism > Overriding vs. Hiding Members), in the last paragraph, is says "[...] it prints 3 instead of 8 [...]", but it actually prints 8 because the object reference is `CrestedPenguin`, whose static method `getHeight` returns 8. FWIW, I tested it in
jshell (java 17.0.2)
So, I think, either the code snippet should be `new Penguin().printInfo();` or change text to "[...] it prints 8 instead of 3 [...]", but I guess this would defeat the purpose of the example, wouldn't it?
Does this make sense, or am I missing something here?
See attached image: