1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 底层是跟着老师写的动态数组。 private Array<E> data; public MaxHeap( int capacity){ data= new Array<>(capacity); } public MaxHeap(){ data= new Array<>(); } 以下代码出现问题 E t=data[i]; //The type of the expression must be an array type but it resolved to Array<E> data[i]=data[j]; data[j]=t; The type of the expression must be an array type but it resolved to Array<E> 鼠标悬停在data[i]出现以上字段. 使用data.get(i)=data.get(j)时也出现错误 |