I'm not sure I've ever considered static vs dynamic method binding in
Java. Most of the time it has to be dynamic because the object we're working on could be the class we say it is or it could be any derived class (see Liskov Substitution Principle). We won't know until run time exactly what kind of object we have.
There might be exceptions. If we invoke a method or class that is final, the compiler might know that no subclass could override it and make a static reference to the method. Or if we create a class and call a method at the same time the compiler might be able to figureout the binding them.
Would such a thing be in the language spec for the compiler or up to the JVM implementor?
And the really big question: Why would we ever care?
[ July 30, 2003: Message edited by: Stan James ]