The so-called "binding )": Is to establish the association between method call (function call) and method body (function body. If the binding occurs on Program Before running, it is called "Early binding". There is no other choice for procedural language. Only one method is to bind the binding action in advance. During the program execution period, the binding action is performed based on the object type, it is called "late binding" or "run-time binding" or "dynamic binding )".
All functions of Java, except those declared as final functions, are bound later. Later binding will automatically take place.
Final is used to prohibit overridding the function, and tells the compiler that the function does not need to be bound later, so that the program can achieve better performance, but in fact, this will not improve the overall efficiency of the program.
Example: Class A {
Public Void Play () {
System.Out. Println ("IsRunning. ");
}
Class B extends {
Public Void Play () {
System.Out. Println ("B"IsRunning. ");
}
Class C extends {
Public Void Play () {
System.Out. Println ("CIsRunning. ");
}
Public Class Testlatebinding {
Static Void Play () {
A. Play ();
}
Public Static Void Main (string [] ARGs) {
Play (NewA ());
Play (NewB ());//Late binding
Play (NewC ());//Late binding
}
}