我收到以下代码的“标识符预期”错误,用于比较2个钱包和打印每对钞票。谢谢你的帮助:
public void printBankNotePairs(Wallet other)
{
StringBuffer myBuffer = new StringBuffer("Pair: ");
for(int i = 0; i < count; i++)
{
for(int j = 0 + i; j < other.length; j++)
{
**if( this.contents[i] == other.[j]){**
myBuffer.append(" " + contents[i]) );
i++;
}
}
}
System.out.println(myBuffer.toString());
}
答案 0 :(得分:1)
似乎您忘记在行
中完成表达式other.[j]
if( this.contents[i] == other.[j]) {
我猜它应该是
other.contents[j]