Originally posted by Tom Tolman:
However, methods are resolved dynamically. The call to sup.printVal() is resolved at run time. At this time, it sees that it ACTUALLY is of type sub, so dynamically binds this method and invokes the subclass version.
Keep in mind that this applies to instance methods only. Static methods are resolved based on the compile-time reference type.