I've read many articles on the difference between static binding and dynamic binding in Java, but none of them really talk about why we need dynamic binding. Why is it that some code should only be bonded during runtime? Why can't all code be bonded at compile time?
I understand the concepts of method overridding and polymorphism, but what I don't understand is why the compiler (during compile time) wouldn't be able to discern that an object is from a subclass and should just use that method instead.