在比较 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());
}
最佳答案
您似乎忘记完成该行中的表达式other.[j]
if( this.contents[i] == other.[j]) {
我猜应该是
other.contents[j]
关于java - 钱包的java代码中的标识符错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22891072/