我需要让用户输入他们想要删除的名称,然后在数组中找到该名称所在的索引。然后我需要删除名称以及价格和评级。我可能只使用并行数组。我不确定它们的其他部分是否成功运行,因为我正在尝试使用 .remove() 并且出现错误:
cannot find symbol
symbol: method remove(int)
location: variable array1 of type String[]
代码
public static void removeGames(Scanner keyboard, String[] array1,
double[] array2, double[] array3, int currentLength)
{
String removeInput;
System.out.println("Enter the name of the game you would like to remove"
+ " from the list: ");
removeInput = keyboard.next();
for(int i = 0; i < array1.length; i++)
{
if(removeInput.equalsIgnoreCase(array1[i]))
{
array1.remove(i);
array2.remove(i);
array3.remove(i);
}
}
}