2013-04-11 126 views

回答

0

如果caller_pq是你想握住你的PriorityQueue然後第二個變量 -
static PriorityQueue<Caller> caller_pq;
caller_pq = new PriorityQueue<Caller>();

- 是正確的。

很難說您的第一個選項PriorityQueue(Caller caller_pq)是什麼意思。如果你打算創建一個PriorityQueue,其中包含Caller類型的元素(這是我認爲你打算的),那麼不,那不行。
如果Caller執行Collection或擴展PriorityQueue那麼它將使PriorityQueue包含caller_pq中的元素(只要您在new之前)。