Card 09/ 09

RecapDifficulty: Advanced1 min

What the Compiler Decided, and What the JVM Did

Five things this topic established, and where each one was.

What the topic established, and which card it was on
The thingWhere
An overridden method is chosen by the object's class, not the variable's typeOne Call, Several Bodies
The declared type decides what may be called; the object decides what runsThe Compiler Checks the Reference
Fields and static methods are hidden, not overridden, and resolve from the declared typeWhy a Field Does Not Override
A cast is a promise the compiler accepts and the runtime checksWhy Your Cast Compiled and Then Threw
Put the method on the type when types change; use a chain when operations doA Polymorphic Call Against a Chain of instanceof

The one worth carrying: exactly one thing in Java is chosen by the object at runtime, and that is an overridden instance method. Fields, static methods and overloads are all chosen earlier, from what the source says the type is.