当作为构造函数参数时,这些可变或者不可变的变量会在一个对象被实例化的时候被初始化。
When used as constructor parameters, the mutable or immutable variables specified will be initialized when an object is instantiated.
在这里实例中,我们也需要声明和初始化一个变量,用来处理Web服务返回的Address复杂类型,如清单13。
In this example, we also need to declare and initialize a variable to handle the Address complex type returned by the Web Service, shown in Listing 13.
在这种情况下,我们定义了变量newtask,并使用新建的Task实体实例对其进行初始化。
In this case we define a variable newTask that we initialize with a new Task entity instance.
ThreadLocal变量与常规变量的不同之处在于,每个线程都有其各自初始化的变量实例,这通过get()或set()方法予以评估。
ThreadLocal variables are different from normal variables in that each thread has its own individually initialized instance of the variable, which it accesses via get() or set() methods.
第二个字段的类型为StaticLocalInitFlag,它在针对foo类的每个实例第一次执行方法时协助正确初始化变量i。
The second field, of type StaticLocalInitFlag, assists in initializing the variable I correctly the first time the method executes on each instance of class Foo.
你应该在静态变量和实例变量上面利用初始化语法。
You should utilize the initializer syntax for both static and instance variables.
不应该使用实例构造函数、一些特殊的私有方法、任何其它习惯来初始化静态变量。
You should not use your instance constructors, some special private function, or any other idiom to initialize static variables.
在创建一个类型的任何实例之前,应该初始化其中的静态成员变量。
You know that you should initialize static member variables in a type before you create any instances of that type.
在创建一个类型的任何实例之前,应该初始化其中的静态成员变量。
You know that you should initialize static member variables in a type before you create any instances of that type.
应用推荐