【发布时间】:2019-07-08 15:35:00
【问题描述】:
我对这条线有疑问(theData = theData1;)是什么意思? 我知道我们创建了另一个名为 theData1 的数组并复制元素,所以这行是什么意思?
private void reallocate ()
{
capacity *= 2;
E[] theData1 = (E[]) new Object[capacity];
for (int i = 0; i < size; i++)
theData1[i] = theData[i];
theData = theData1;
}
【问题讨论】:
-
相关:Array assignment and reference in Java。您可能想搜索更多。