public class SeqQueue<E> {
private Object[] arr; // 数组
private int front, rear; // 前后指针
private final int SIZE = 12; // 默认长度
//有参构造器
public SeqQueue(int length){
if(length < SIZE){
length = SIZE;
}
arr = new Object[length];
front = 0;
rear = 0;
}
//无参构造器
public SeqQueue(){
this(SIZE); // 报错 Cannot reference 'SeqQueue.SIZE' before supertype constructor has been called
}
}
问题:为什么在无参构造器中传入常量SIZE会报错,而在final前面加上static后就不会报错?