During the dynamic binding process, the object calls the object party's execution process
1: The compiler looks at the declaration type and method name of the object. There may be multiple overloaded methods with the same method name but different parameter types.
2: The compiler looks at the type of arguments that are provided when the method is called. This procedure is called overload resolution, in the same method name has a parameter type exactly match the method, select this appropriate method. If you do not find a method that matches a parameter type, or if there is no matching method after the conversion type, an error will also be found.
3: If it is private or static or the final method or constructor, then the compiler will be able to know exactly which method to call, which is called static binding. By contrast, the method that is called relies on the actual type of the implicit parameter, and it implements dynamic binding at run time.
4: When the program runs, and when the method is called dynamically bound, the virtual machine must call the method of the class that is most appropriate for the actual type of the object referenced by x, and it is expensive to search every time the method is called. The virtual machine creates a method table in advance for each class, listing the signature of all methods and the actual method of invocation, and then directly checking a method table when the call is actually made.
Java Learning Path-inheritance (polymorphic dynamic binding)