但是,在贫乏显式构造器的情形下,编译器会自动供应一个公有的、无参的缺省构造器(default constructor),关于用户而言,这个构造器与其他的构造器没有任何辨别.在已发行的API中常常可以看到一些被无意识实例化的类.
基于68个网页-相关网页
您必须具有公共缺省构造器。
上面的代码首先使用缺省的构造器创建一个新InitialContext。
This code first creates a new InitialContext using the default constructor.
如果在mixin实例化中没有指定任何构造器,那么就假定是缺省的不带参数的(zeroary)构造器。
If no constructors are specified in a mixin instantiation, the default zero-argument (zeroary) constructor is assumed.
应用推荐