我想返回数组中的最高和最低值,我无法获得它的编译。对我来说,似乎一切都应该是好的,但我不断收到return new int[] = {minBid, highBid}
奇怪的错误。为什么不能编译?
public int[] rangeOfBids()
{
Bid minBid = bids[0];
for(int i = 0; i < bids.length; i++)
{
if (bids[i].higherBidThan(minBid))
bids[i] = minBid;
}
Bid highBid = bids[0];
for(int i = 0; i < bids.length; i++)
{
if (bids[i].higherBidThan(highBid))
highBid = bids[i];
}
return new int[] = {minBid, highBid};
}
嗨,欢迎来到stackoverflow!请阅读[*本*](http://stackoverflow.com/faq#howtoask) – alfasin