这是我从列表中删除记录的代码,但我似乎无法让它工作。有什么建议么?
public void deleteRecord (Scanner in)
{
int delete = 0;
showRecords();
System.out.println("Enter the number in the list to delete:");
delete = in.nextInt();
delete = delete -1;
for (int i = delete; i < this.size; i++)
{
this.collection[i] = this.collection[i + 1];
this.collection[size] = null;
this.size--;
System.out.println("Record deleted successfully");
showRecords();
}
System.out.println("Please enter a number in the list to delete");
}
守候你守候我
慕容3067478
相关分类