确实需要帮助,因为患者没有被设置为替换null。我们必须创建一个包含50个空值的数组列表,以便迭代器遍历该列表,如果找到空值,它会将其设置为患者。问题是没有患者被设置为null。protected int amountOfBeds = 50;
ArrayList<Patient> bedList = new ArrayList<Patient>(amountOfBeds);
我的程序会编译,但是当我运行它时,它会给我一个IndexOutOfBoundsException。我想知道它有什么问题,因为我看不见它。我的程序应该接受用户的输入并将其添加到ArrayList中。如果我的错误对您来说很明显,我很抱歉,但是我在使用ArrayLists方面还比较新。谢谢!ArrayList<ArrayList<Integer>> arr = new ArrayList<ArrayLi