-3
对于java中的类,我是否需要为构造函数中的每个字段赋值?我是否需要在java中的类构造函数中定义所有的字段?
public class GenericList<T> {
private final int MAX_SIZE;
private List<T> s = new ArrayList<T>();
public GenericList() {
this.MAX_SIZE = 100;
}
也,在子类中,如果我想重新定义只值中的一个父类的构造,我需要从超重新状态的值,或者我可以离开它完全?
public class SafeZone extends GenericList<SafeZone> {
final private int MAX_SIZE;
private GenericList<SafeZone> safeZone;
public SafeZone() {
super(1);
}
你为什么不测试它?或阅读规格? – shmosel