在处理这个铸造对象和诸如此类的概念时,我现在非常困惑,但我相信我已经非常接近完成了。如果您可以查看我的代码并提示我可以做些什么来停止收到此错误,那就太好了。
public E remove(int position){
position -= 1;
if(outOfBounds(position))
throw new RuntimeException("Invalid position.");
E[] temp;
temp = (E[])storage[position];// around here is where I receive the error
currentSize--;
shiftLeft(position);
return temp[position];
}// DONE
这是我在第一次回复的建议之后的第二次尝试(但是,仍然收到未经检查的强制转换错误):
public E remove(int position){
position -= 1;
if(outOfBounds(position))
throw new RuntimeException("Invalid position.");
E[]temp = (E[])new Object[maxSize];
temp = (E[])storage[position];
currentSize--;
shiftLeft(position);
return temp[position];}// DONE