gpt4 book ai didi

java - 为什么我可以更改 private final ArrayList

转载 作者:行者123 更新时间:2023-12-02 05:23:56 24 4
gpt4 key购买 nike

<分区>

我有这样的类(class):

public class InformationSystem {
private final ArrayList<Book> books;
private final ArrayList<Reader> readers;

public InformationSystem() {
books = new ArrayList<Book>();
readers = new ArrayList<Reader>();
}

public void addBook(final String author, final String title) {
Book book = new Book(author, title);
books.add(book);
}
}

为什么我可以从最终的数组列表中添加/删除值?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com