SCJP1.6 JAVA 6 CERTIFICATION Guide-310-065
by Katherine Sierra (Author), Bert Bates (Author)
chapter 2:object orienation
pg-102
even though the compiler
only knows about the declared reference type, the
Java Virtual Machine (JVM)
at runtime knows what the object really is. And that means that even if the
PlayerPiece object's displayShape() method is called using a GameShape
reference variable, if the PlayerPiece overrides the displayShape() method, the
JVM will invoke the PlayerPiece version! The JVM looks at the real object at the
other end of the reference, "sees" that it has overridden the method of the declared
reference variable type, and invokes the method of the object's actual class
can anyone illustrate with an example