I would like to clarify a few things about binding and dispatch.
Binding is attaching a method call to a method signature. Dispatch is choosing over method implementations. First comes binding, then comes dispatch. OK, I got this, but:
- Do instance methods that have not been overridden use static binding?
- Why exactly do overloaded methods use static binding since they are virtual and can be overridden in subclasses?
I've read lots of explanations over the last few days and it's a mess for me now. Some of them are conflicting or completely opposite from one another. From what I know all non-static
, non-private
and non-final
methods in Java are virtual by default and must use dynamic binding and dynamic dispatch.