我正在創建一個存儲java.time.LocalDate對象的堆程序。雖然我無法爲LocalDate創建臨時變量。我可以做一個小的失誤,但這裏是我的代碼在堆中創建`LocalDate`(java.time)時出錯
private void trickleUp(int n) {
int pIndex;
if (n != 0) {
pIndex = getParentIndex(n);
if (heapA[pIndex].isAfter(heapA[n])) {
LocalDate temp = new LocalDate(heapA[pIndex]);
heapA[pIndex] = heapA[n];
heapA[n] = temp;
trickleUp(pIndex);
}
}
}
即時得到錯誤「的構造LOCALDATE的(LOCALDATE的)是未定義」
您可以向我們展示您的LocalDate課程嗎? – 2014-10-26 16:47:37
@capslock它是Java 8引入的'java.time'包中的標準Java類。 – Pshemo 2014-10-26 16:48:41