从根本上讲,绑定是通过显式声明或隐式声明将一事物分配给另一事物,通常是将值赋给变量。 对于编程新手来说,显式和隐式声明这些术语似乎并不令人望而生畏。 显式声明仅表示定义变量名称及其类型的语句,例如
public int i;
而在隐式中,实现默认约定,例如
int i;
它假定它是公开的。 捆绑整数a,b = 0;变量可以在运行时或在编译时发生,当它在运行时发生时,变量的当前状态会因为为其分配了一个值而发生更改。 例如
int a, b = 0, c;
for(a = 0; a < 10; a++){
b+=c;
}
的状态C Changes as values are been added as the 对于 loop is being exeCuted。 绑定类型 DynamiC Binding:变量根据指定的值绑定到类型。 this happens at run-time。 StatiC Binding : This happens at Compile time where the Compiler figures out what variable to assign to what method or funCtion。 一种 perfeCt example is method overloading where two methods have same name but different number or type of parameter。 If two parameters are passed in a method 一种 (that has two parameters), the Compiler figures out that the method to return is 一种。 Hope this helps。