Java有帮助吗? '(' '[' 预期的
Java help? '(' '[' expected
有人可以指出额外的“(”或“[”应该放在哪里吗?
private void pickItem(Command command)
{
String item = command.getSecondWord();
Item newItem;
Room r= thePlayer.getRoom();
newItem = r.getItem;
if (newItem == null)
System.out.println("That item is not here");
else {
inventory.add(new Item);
r.removeItem(item);
System.out.println("Picked Up:" + item);
}
}
new
需要括号:
inventory.add(new Item());
有人可以指出额外的“(”或“[”应该放在哪里吗?
private void pickItem(Command command)
{
String item = command.getSecondWord();
Item newItem;
Room r= thePlayer.getRoom();
newItem = r.getItem;
if (newItem == null)
System.out.println("That item is not here");
else {
inventory.add(new Item);
r.removeItem(item);
System.out.println("Picked Up:" + item);
}
}
new
需要括号:
inventory.add(new Item());