当作为构造函数参数时,这些可变或者不可变的变量会在一个对象被实例化的时候被初始化。
When used as constructor parameters, the mutable or immutable variables specified will be initialized when an object is instantiated.
要创建一个线程局部变量,请实例化类ThreadLocal的一个对象。
To create a thread-local variable, you instantiate an object of class ThreadLocal.
这意味着,如果一个变量被声明为接口类型,其值可参考,即实例化任何实现接口的类的任何对象。
This means that if a variable is declared to be the type of an interface, its value can reference any object that is instantiated from any class that implements the interface.
应用推荐